public abstract class AbstractReadableInstantFieldProperty
extends java.lang.Object
implements java.io.Serializable
It allows the date and time manipulation code to be field based yet still easy to use.
AbstractReadableInstantFieldProperty itself is thread-safe and immutable, but the ReadableInstant being operated on may be mutable and not thread-safe.
Constructor and Description |
---|
AbstractReadableInstantFieldProperty()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(ReadableInstant instant)
Compare this field to the same field on another instant.
|
int |
compareTo(ReadablePartial partial)
Compare this field to the same field on another partial instant.
|
boolean |
equals(java.lang.Object object)
Compares this property to another.
|
int |
get()
Gets the value of this property from the instant.
|
java.lang.String |
getAsShortText()
Gets the short textual value of this property from the instant as a
string in the default locale.
|
java.lang.String |
getAsShortText(java.util.Locale locale)
Gets the short textual value of this property from the instant as a
string in the specified locale.
|
java.lang.String |
getAsString()
Gets the value of this property from the instant as a string.
|
java.lang.String |
getAsText()
Gets the textual value of this property from the instant as a
string in the default locale.
|
java.lang.String |
getAsText(java.util.Locale locale)
Gets the textual value of this property from the instant as a
string in the specified locale.
|
int |
getDifference(ReadableInstant instant)
Returns the difference between this field property instant and the one
passed in, in the units of this field.
|
long |
getDifferenceAsLong(ReadableInstant instant)
Returns the difference between this field property instant and the one
passed in, in the units of this field.
|
DurationField |
getDurationField()
Returns the duration per unit value of this field.
|
abstract DateTimeField |
getField()
Gets the field being used.
|
DateTimeFieldType |
getFieldType()
Gets the field type being used.
|
int |
getLeapAmount()
Gets the amount by which this field is leap.
|
DurationField |
getLeapDurationField()
If this field were to leap, then it would be in units described by the
returned duration.
|
int |
getMaximumShortTextLength(java.util.Locale locale)
Gets the maximum short text length for the field.
|
int |
getMaximumTextLength(java.util.Locale locale)
Gets the maximum text length for the field.
|
int |
getMaximumValue()
Gets the maximum value for the field.
|
int |
getMaximumValueOverall()
Gets the maximum value for the field ignoring the current time.
|
int |
getMinimumValue()
Gets the minimum value for the field.
|
int |
getMinimumValueOverall()
Gets the minimum value for the field ignoring the current time.
|
java.lang.String |
getName()
Gets the name of the field.
|
DurationField |
getRangeDurationField()
Returns the range duration of this field.
|
int |
hashCode()
Returns a hashcode compatible with the equals method.
|
boolean |
isLeap()
Gets whether this field is leap.
|
long |
remainder()
Returns the fractional duration milliseconds of this field.
|
Interval |
toInterval()
Returns the interval that represents the range of the minimum
and maximum values of this field.
|
java.lang.String |
toString()
Output a debugging string.
|
public AbstractReadableInstantFieldProperty()
public abstract DateTimeField getField()
public DateTimeFieldType getFieldType()
public java.lang.String getName()
public int get()
For example, the following two lines of code are equivalent:
datetime.getDayOfMonth(); datetime.dayOfMonth().get();
DateTimeField.get(long)
public java.lang.String getAsString()
This method returns the value converted to a String
using Integer.toString
. This method does NOT return
textual descriptions such as 'Monday' or 'January'.
See getAsText()
and getAsShortText()
for those.
DateTimeField.get(long)
public java.lang.String getAsText()
This method returns the value converted to a String
returning the appropriate textual description wherever possible.
Thus, a day of week of 1 would return 'Monday' in English.
DateTimeField.getAsText(long, java.util.Locale)
public java.lang.String getAsText(java.util.Locale locale)
This method returns the value converted to a String
returning the appropriate textual description wherever possible.
Thus, a day of week of 1 would return 'Monday' in English.
locale
- locale to use for selecting a text symbol, null means defaultDateTimeField.getAsText(long, java.util.Locale)
public java.lang.String getAsShortText()
This method returns the value converted to a String
returning the appropriate textual description wherever possible.
Thus, a day of week of 1 would return 'Mon' in English.
DateTimeField.getAsShortText(long, java.util.Locale)
public java.lang.String getAsShortText(java.util.Locale locale)
This method returns the value converted to a String
returning the appropriate textual description wherever possible.
Thus, a day of week of 1 would return 'Mon' in English.
locale
- locale to use for selecting a text symbol, null means defaultDateTimeField.getAsShortText(long, java.util.Locale)
public int getDifference(ReadableInstant instant)
instant
- the subtrahend, null means nowDateTimeField.getDifference(long, long)
public long getDifferenceAsLong(ReadableInstant instant)
instant
- the subtrahend, null means nowDateTimeField.getDifference(long, long)
public DurationField getDurationField()
public DurationField getRangeDurationField()
public boolean isLeap()
DateTimeField.isLeap(long)
public int getLeapAmount()
DateTimeField.getLeapAmount(long)
public DurationField getLeapDurationField()
public int getMinimumValueOverall()
DateTimeField.getMinimumValue()
public int getMinimumValue()
DateTimeField.getMinimumValue()
public int getMaximumValueOverall()
DateTimeField.getMaximumValue()
public int getMaximumValue()
DateTimeField.getMaximumValue()
public int getMaximumTextLength(java.util.Locale locale)
locale
- optional locale to use for selecting a text symbolDateTimeField.getMaximumTextLength(java.util.Locale)
public int getMaximumShortTextLength(java.util.Locale locale)
locale
- optional locale to use for selecting a text symbolDateTimeField.getMaximumShortTextLength(java.util.Locale)
public long remainder()
DateTimeField.remainder(long)
public Interval toInterval()
For example, datetime.monthOfYear().toInterval()
will return an interval over the whole month.
public int compareTo(ReadableInstant instant)
The comparison is based on the value of the same field type, irrespective of any difference in chronology. Thus, if this property represents the hourOfDay field, then the hourOfDay field of the other instant will be queried whether in the same chronology or not.
instant
- the instant to compare tojava.lang.IllegalArgumentException
- if the instant is nullpublic int compareTo(ReadablePartial partial)
The comparison is based on the value of the same field type, irrespective of any difference in chronology. Thus, if this property represents the hourOfDay field, then the hourOfDay field of the other partial will be queried whether in the same chronology or not.
partial
- the partial to compare tojava.lang.IllegalArgumentException
- if the partial is nulljava.lang.IllegalArgumentException
- if the partial doesn't support this fieldpublic boolean equals(java.lang.Object object)
equals
in class java.lang.Object
object
- the object to compare topublic int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2010 - 2020 Adobe. All Rights Reserved