org.joda.time.field
Class AbstractPartialFieldProperty
java.lang.Object
org.joda.time.field.AbstractPartialFieldProperty
public abstract class AbstractPartialFieldProperty
extends java.lang.Object
AbstractPartialFieldProperty is a base class for binding a
ReadablePartial to a DateTimeField.
It allows the date and time manipulation code to be field based yet
still easy to use.
- Stephen Colebourne
- Brian S O'Neill
AbstractPartialFieldProperty
protected AbstractPartialFieldProperty()
Constructor.
compareTo
public int compareTo(ReadableInstant instant)
Compare this field to the same field on another 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 to
- negative value if this is less, 0 if equal, or positive value if greater
compareTo
public int compareTo(ReadablePartial partial)
Compare this field to the same field on another partial 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 partial will be queried
whether in the same chronology or not.
partial
- the partial to compare to
- negative value if this is less, 0 if equal, or positive value if greater
equals
public boolean equals(Object object)
Compares this property to another.
object
- the object to compare to
get
public abstract int get()
Gets the value of this property from the instant.
For example, the following two lines of code are equivalent:
partial.getDayOfMonth();
partial.dayOfMonth().get();
getAsShortText
public String getAsShortText()
Gets the short textual value of this property from the instant as a
string in the default 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.
DateTimeField.getAsShortText
getAsShortText
public String getAsShortText(Locale locale)
Gets the short textual value of this property from the instant as a
string in the specified 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 default
DateTimeField.getAsShortText
getAsString
public String getAsString()
Gets the value of this property from the instant as a string.
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.
getAsText
public String getAsText()
Gets the textual value of this property from the instant as a
string in the default 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.
getAsText
public String getAsText(Locale locale)
Gets the textual value of this property from the instant as a
string in the specified 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 default
getDurationField
public DurationField getDurationField()
Returns the duration per unit value of this field. For example, if this
field represents "hour of day", then the duration is an hour.
- the duration of this field, or UnsupportedDurationField
getField
public abstract DateTimeField getField()
Gets the field being used.
getMaximumShortTextLength
public int getMaximumShortTextLength(Locale locale)
Gets the maximum short text length for the field.
locale
- optional locale to use for selecting a text symbol
getMaximumTextLength
public int getMaximumTextLength(Locale locale)
Gets the maximum text length for the field.
locale
- optional locale to use for selecting a text symbol
getMaximumValue
public int getMaximumValue()
Gets the maximum value for this field given the current field values.
DateTimeField.getMaximumValue
getMaximumValueOverall
public int getMaximumValueOverall()
Gets the maximum value for the field ignoring the current time.
DateTimeField.getMaximumValue
getMinimumValue
public int getMinimumValue()
Gets the minimum value for this field given the current field values.
DateTimeField.getMinimumValue
getMinimumValueOverall
public int getMinimumValueOverall()
Gets the minimum value for the field ignoring the current time.
DateTimeField.getMinimumValue
getName
public String getName()
Gets the name of the field.
getRangeDurationField
public DurationField getRangeDurationField()
Returns the range duration of this field. For example, if this field
represents "hour of day", then the range duration is a day.
- the range duration of this field, or null if field has no range
getReadablePartial
protected abstract ReadablePartial getReadablePartial()
Gets the partial instant being used.
hashCode
public int hashCode()
Gets a suitable hashcode for the object.
toString
public String toString()
Output a debugging string.
Copyright (c) 2001-2006 - Joda.org