public abstract class PreciseDurationDateTimeField extends BaseDateTimeField
PreciseDurationDateTimeField is thread-safe and immutable, and its subclasses must be as well.
Constructor and Description |
---|
PreciseDurationDateTimeField(DateTimeFieldType type,
DurationField unit)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
DurationField |
getDurationField()
Returns the duration per unit value of this field.
|
int |
getMinimumValue()
Get the minimum value for the field.
|
long |
getUnitMillis() |
boolean |
isLenient()
Returns false by default.
|
long |
remainder(long instant)
This method assumes that this field is properly rounded on
1970-01-01T00:00:00.
|
long |
roundCeiling(long instant)
This method assumes that this field is properly rounded on
1970-01-01T00:00:00.
|
long |
roundFloor(long instant)
This method assumes that this field is properly rounded on
1970-01-01T00:00:00.
|
long |
set(long instant,
int value)
Set the specified amount of units to the specified time instant.
|
add, add, add, addWrapField, addWrapField, addWrapPartial, get, getAsShortText, getAsShortText, getAsShortText, getAsShortText, getAsShortText, getAsText, getAsText, getAsText, getAsText, getAsText, getDifference, getDifferenceAsLong, getLeapAmount, getLeapDurationField, getMaximumShortTextLength, getMaximumTextLength, getMaximumValue, getMaximumValue, getMaximumValue, getMaximumValue, getMinimumValue, getMinimumValue, getMinimumValue, getName, getRangeDurationField, getType, isLeap, isSupported, roundHalfCeiling, roundHalfEven, roundHalfFloor, set, set, set, set, toString
setExtended
public PreciseDurationDateTimeField(DateTimeFieldType type, DurationField unit)
type
- the field typeunit
- precise unit duration, like "days()".java.lang.IllegalArgumentException
- if duration field is imprecisejava.lang.IllegalArgumentException
- if unit milliseconds is less than onepublic boolean isLenient()
isLenient
in class DateTimeField
public long set(long instant, int value)
set
in class BaseDateTimeField
instant
- the milliseconds from 1970-01-01T00:00:00Z to set invalue
- value of units to set.java.lang.IllegalArgumentException
- if value is too large or too small.public long roundFloor(long instant)
return super.roundFloor(instant + ALIGNMENT_MILLIS) - ALIGNMENT_MILLIS;
roundFloor
in class BaseDateTimeField
instant
- the milliseconds from 1970-01-01T00:00:00Z to roundpublic long roundCeiling(long instant)
return super.roundCeiling(instant + ALIGNMENT_MILLIS) - ALIGNMENT_MILLIS;
roundCeiling
in class BaseDateTimeField
instant
- the milliseconds from 1970-01-01T00:00:00Z to roundpublic long remainder(long instant)
return super.remainder(instant + ALIGNMENT_MILLIS);
remainder
in class BaseDateTimeField
instant
- the milliseconds from 1970-01-01T00:00:00Z to get the
remainderpublic DurationField getDurationField()
getDurationField
in class BaseDateTimeField
public int getMinimumValue()
getMinimumValue
in class BaseDateTimeField
public final long getUnitMillis()
"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"