public abstract class DecoratedDateTimeField extends BaseDateTimeField
DecoratedDateTimeField
extends BaseDateTimeField
,
implementing only the minimum required set of methods. These implemented
methods delegate to a wrapped field.
This design allows new DateTimeField types to be defined that piggyback on top of another, inheriting all the safe method implementations from BaseDateTimeField. Should any method require pure delegation to the wrapped field, simply override and use the provided getWrappedField method.
DecoratedDateTimeField is thread-safe and immutable, and its subclasses must be as well.
DelegatedDateTimeField
Modifier and Type | Method and Description |
---|---|
int |
get(long instant)
Get the value of this field from the milliseconds.
|
DurationField |
getDurationField()
Returns the duration per unit value of this field.
|
int |
getMaximumValue()
Get the maximum allowable value for this field.
|
int |
getMinimumValue()
Get the minimum allowable value for this field.
|
DurationField |
getRangeDurationField()
Returns the range duration of this field.
|
DateTimeField |
getWrappedField()
Gets the wrapped date time field.
|
boolean |
isLenient()
Returns true if the set method is lenient.
|
long |
roundFloor(long instant)
Round to the lowest whole unit of this field.
|
long |
set(long instant,
int value)
Sets a value in the milliseconds supplied.
|
add, add, add, addWrapField, addWrapField, addWrapPartial, getAsShortText, getAsShortText, getAsShortText, getAsShortText, getAsShortText, getAsText, getAsText, getAsText, getAsText, getAsText, getDifference, getDifferenceAsLong, getLeapAmount, getLeapDurationField, getMaximumShortTextLength, getMaximumTextLength, getMaximumValue, getMaximumValue, getMaximumValue, getMinimumValue, getMinimumValue, getMinimumValue, getName, getType, isLeap, isSupported, remainder, roundCeiling, roundHalfCeiling, roundHalfEven, roundHalfFloor, set, set, set, set, toString
setExtended
public final DateTimeField getWrappedField()
public boolean isLenient()
DateTimeField
isLenient
in class DateTimeField
public int get(long instant)
BaseDateTimeField
get
in class BaseDateTimeField
instant
- the milliseconds from 1970-01-01T00:00:00Z to querypublic long set(long instant, int value)
BaseDateTimeField
The value of this field will be set. If the value is invalid, an exception if thrown.
If setting this field would make other fields invalid, then those fields may be changed. For example if the current date is the 31st January, and the month is set to February, the day would be invalid. Instead, the day would be changed to the closest value - the 28th/29th February as appropriate.
set
in class BaseDateTimeField
instant
- the milliseconds from 1970-01-01T00:00:00Z to set invalue
- the value to set, in the units of the fieldpublic DurationField getDurationField()
BaseDateTimeField
getDurationField
in class BaseDateTimeField
public DurationField getRangeDurationField()
BaseDateTimeField
getRangeDurationField
in class BaseDateTimeField
public int getMinimumValue()
BaseDateTimeField
getMinimumValue
in class BaseDateTimeField
public int getMaximumValue()
BaseDateTimeField
getMaximumValue
in class BaseDateTimeField
public long roundFloor(long instant)
BaseDateTimeField
For example, a datetime of 2002-11-02T23:34:56.789, rounded to the lowest whole hour is 2002-11-02T23:00:00.000.
roundFloor
in class BaseDateTimeField
instant
- the milliseconds from 1970-01-01T00:00:00Z to roundCopyright © 2010 - 2020 Adobe. All Rights Reserved