public enum CalendarDateUnit extends Enum<CalendarDateUnit> implements TemporalUnit, CalendarDate.Resolution, Comparable<CalendarDateUnit>
Designed to complement CalendarDate. It is essentially equivalent to ChronoUnit, but with a sligthly smaller set of members (and the addtional QUARTER). It has been retrofitted to implement the TemporalUnit interface.
CalendarDate
,
CalendarDateDuration
Enum Constant and Description |
---|
CENTURY |
DAY |
DECADE |
HOUR |
MICROS |
MILLENIUM |
MILLIS |
MINUTE |
MONTH |
NANOS |
QUARTER |
SECOND |
WEEK |
YEAR |
Modifier and Type | Method and Description |
---|---|
<R extends Temporal> |
addTo(R temporal,
long amount) |
long |
adjustInto(long epochMilli)
Maps a range of instances in time to a single instance.
|
Temporal |
adjustInto(Temporal temporal) |
long |
between(Temporal temporal1Inclusive,
Temporal temporal2Exclusive) |
CalendarDateDuration |
convert(CalendarDateDuration sourceDuration) |
double |
convert(CalendarDateUnit aSourceDurationUnit) |
double |
convert(double sourceDurationMeasure,
CalendarDateUnit sourceDurationUnit) |
long |
convert(long sourceMeassure,
CalendarDateUnit sourceUnit) |
long |
count(long aFromValue,
long aToValue) |
long |
get(TemporalUnit unit) |
Optional<ChronoUnit> |
getChronoUnit() |
Duration |
getDuration() |
String |
getLabel() |
Optional<TimeUnit> |
getTimeUnit() |
List<TemporalUnit> |
getUnits() |
boolean |
isCalendarUnit() |
boolean |
isDateBased() |
boolean |
isDurationEstimated() |
boolean |
isTimeBased() |
CalendarDateDuration |
newDuration(double meassure) |
long |
toDurationInMillis()
The size/duration of a timeline resolution "unit".
|
long |
toDurationInNanos() |
static CalendarDateUnit |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static CalendarDateUnit[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
isSupportedBy, toString
addTo
compareTo
public static final CalendarDateUnit NANOS
public static final CalendarDateUnit MICROS
public static final CalendarDateUnit MILLIS
public static final CalendarDateUnit SECOND
public static final CalendarDateUnit MINUTE
public static final CalendarDateUnit HOUR
public static final CalendarDateUnit DAY
public static final CalendarDateUnit WEEK
public static final CalendarDateUnit MONTH
public static final CalendarDateUnit QUARTER
public static final CalendarDateUnit YEAR
public static final CalendarDateUnit DECADE
public static final CalendarDateUnit CENTURY
public static final CalendarDateUnit MILLENIUM
public static CalendarDateUnit[] values()
for (CalendarDateUnit c : CalendarDateUnit.values()) System.out.println(c);
public static CalendarDateUnit valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic <R extends Temporal> R addTo(R temporal, long amount)
addTo
in interface TemporalUnit
public long adjustInto(long epochMilli)
CalendarDate.Resolution
adjustInto
in interface CalendarDate.Resolution
public Temporal adjustInto(Temporal temporal)
adjustInto
in interface TemporalAdjuster
public long between(Temporal temporal1Inclusive, Temporal temporal2Exclusive)
between
in interface TemporalUnit
public CalendarDateDuration convert(CalendarDateDuration sourceDuration)
public double convert(CalendarDateUnit aSourceDurationUnit)
public double convert(double sourceDurationMeasure, CalendarDateUnit sourceDurationUnit)
public long convert(long sourceMeassure, CalendarDateUnit sourceUnit)
public long count(long aFromValue, long aToValue)
public long get(TemporalUnit unit)
public Optional<ChronoUnit> getChronoUnit()
public Duration getDuration()
getDuration
in interface TemporalUnit
public String getLabel()
public List<TemporalUnit> getUnits()
public boolean isCalendarUnit()
public boolean isDateBased()
isDateBased
in interface TemporalUnit
public boolean isDurationEstimated()
isDurationEstimated
in interface TemporalUnit
public boolean isTimeBased()
isTimeBased
in interface TemporalUnit
public CalendarDateDuration newDuration(double meassure)
public long toDurationInMillis()
CalendarDate.Resolution
toDurationInMillis
in interface CalendarDate.Resolution
public long toDurationInNanos()
toDurationInNanos
in interface CalendarDate.Resolution
Copyright © 2019 Optimatika. All rights reserved.