public abstract class AbstractPartialFieldProperty extends Object
It allows the date and time manipulation code to be field based yet still easy to use.
Modifier | Constructor and Description |
---|---|
protected |
AbstractPartialFieldProperty()
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(Object object)
Compares this property to another.
|
abstract int |
get()
Gets the value of this property from the instant.
|
String |
getAsShortText()
Gets the short textual value of this property from the instant as a
string in the default locale.
|
String |
getAsShortText(Locale locale)
Gets the short textual value of this property from the instant as a
string in the specified locale.
|
String |
getAsString()
Gets the value of this property from the instant as a string.
|
String |
getAsText()
Gets the textual value of this property from the instant as a
string in the default locale.
|
String |
getAsText(Locale locale)
Gets the textual value of this property from the instant as a
string in the specified locale.
|
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 |
getMaximumShortTextLength(Locale locale)
Gets the maximum short text length for the field.
|
int |
getMaximumTextLength(Locale locale)
Gets the maximum text length for the field.
|
int |
getMaximumValue()
Gets the maximum value for this field given the current field values.
|
int |
getMaximumValueOverall()
Gets the maximum value for the field ignoring the current time.
|
int |
getMinimumValue()
Gets the minimum value for this field given the current field values.
|
int |
getMinimumValueOverall()
Gets the minimum value for the field ignoring the current time.
|
String |
getName()
Gets the name of the field.
|
DurationField |
getRangeDurationField()
Returns the range duration of this field.
|
protected abstract ReadablePartial |
getReadablePartial()
Gets the partial instant being used.
|
int |
hashCode()
Gets a suitable hashcode for the object.
|
String |
toString()
Output a debugging string.
|
protected AbstractPartialFieldProperty()
public abstract DateTimeField getField()
public DateTimeFieldType getFieldType()
public String getName()
protected abstract ReadablePartial getReadablePartial()
public abstract int get()
For example, the following two lines of code are equivalent:
partial.getDayOfMonth(); partial.dayOfMonth().get();
public 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 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 String getAsText(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 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 String getAsShortText(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 DurationField getDurationField()
public DurationField getRangeDurationField()
public int getMinimumValueOverall()
DateTimeField.getMinimumValue()
public int getMinimumValue()
DateTimeField.getMinimumValue()
public int getMaximumValueOverall()
DateTimeField.getMaximumValue()
public int getMaximumValue()
DateTimeField.getMaximumValue()
public int getMaximumTextLength(Locale locale)
locale
- optional locale to use for selecting a text symbolDateTimeField.getMaximumTextLength(java.util.Locale)
public int getMaximumShortTextLength(Locale locale)
locale
- optional locale to use for selecting a text symbolDateTimeField.getMaximumShortTextLength(java.util.Locale)
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 toIllegalArgumentException
- if the instant is null or the instant
doesn't support the field of this propertypublic 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 toIllegalArgumentException
- if the instant is nullIllegalArgumentException
- if the field of this property cannot be queried
on the specified instantpublic boolean equals(Object object)
public int hashCode()
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.