Class Partial.Property
- All Implemented Interfaces:
Serializable
- Enclosing class:
- Partial
Partial
.
This class binds a Partial
to a DateTimeField
.
- Since:
- 1.1
- Author:
- Stephen Colebourne
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionaddToCopy
(int valueToAdd) Adds to the value of this field in a copy of this Partial.addWrapFieldToCopy
(int valueToAdd) Adds to the value of this field in a copy of this Partial wrapping within this field if the maximum value is reached.int
get()
Gets the value of this field.getField()
Gets the field that this property uses.Gets the partial that this property belongs to.protected ReadablePartial
Gets the partial that this property belongs to.setCopy
(int value) Sets this field in a copy of the Partial.Sets this field in a copy of the Partial to a parsed text value.Sets this field in a copy of the Partial to a parsed text value.Returns a new Partial with this field set to the maximum value for this field.Returns a new Partial with this field set to the minimum value for this field.Methods inherited from class org.joda.time.field.AbstractPartialFieldProperty
compareTo, compareTo, equals, getAsShortText, getAsShortText, getAsString, getAsText, getAsText, getDurationField, getFieldType, getMaximumShortTextLength, getMaximumTextLength, getMaximumValue, getMaximumValueOverall, getMinimumValue, getMinimumValueOverall, getName, getRangeDurationField, hashCode, toString
-
Method Details
-
getField
Gets the field that this property uses.- Specified by:
getField
in classAbstractPartialFieldProperty
- Returns:
- the field
-
getReadablePartial
Gets the partial that this property belongs to.- Specified by:
getReadablePartial
in classAbstractPartialFieldProperty
- Returns:
- the partial
-
getPartial
Gets the partial that this property belongs to.- Returns:
- the partial
-
get
public int get()Gets the value of this field.- Specified by:
get
in classAbstractPartialFieldProperty
- Returns:
- the field value
-
addToCopy
Adds to the value of this field in a copy of this Partial.The value will be added to this field. If the value is too large to be added solely to this field then it will affect larger fields. Smaller fields are unaffected.
If the result would be too large, beyond the maximum year, then an IllegalArgumentException is thrown.
The Partial attached to this property is unchanged by this call. Instead, a new instance is returned.
- Parameters:
valueToAdd
- the value to add to the field in the copy- Returns:
- a copy of the Partial with the field value changed
- Throws:
IllegalArgumentException
- if the value isn't valid
-
addWrapFieldToCopy
Adds to the value of this field in a copy of this Partial wrapping within this field if the maximum value is reached.The value will be added to this field. If the value is too large to be added solely to this field then it wraps within this field. Other fields are unaffected.
For example,
2004-12-20
addWrapField one month returns2004-01-20
.The Partial attached to this property is unchanged by this call. Instead, a new instance is returned.
- Parameters:
valueToAdd
- the value to add to the field in the copy- Returns:
- a copy of the Partial with the field value changed
- Throws:
IllegalArgumentException
- if the value isn't valid
-
setCopy
Sets this field in a copy of the Partial.The Partial attached to this property is unchanged by this call. Instead, a new instance is returned.
- Parameters:
value
- the value to set the field in the copy to- Returns:
- a copy of the Partial with the field value changed
- Throws:
IllegalArgumentException
- if the value isn't valid
-
setCopy
Sets this field in a copy of the Partial to a parsed text value.The Partial attached to this property is unchanged by this call. Instead, a new instance is returned.
- Parameters:
text
- the text value to setlocale
- optional locale to use for selecting a text symbol- Returns:
- a copy of the Partial with the field value changed
- Throws:
IllegalArgumentException
- if the text value isn't valid
-
setCopy
Sets this field in a copy of the Partial to a parsed text value.The Partial attached to this property is unchanged by this call. Instead, a new instance is returned.
- Parameters:
text
- the text value to set- Returns:
- a copy of the Partial with the field value changed
- Throws:
IllegalArgumentException
- if the text value isn't valid
-
withMaximumValue
Returns a new Partial with this field set to the maximum value for this field.The Partial attached to this property is unchanged by this call.
- Returns:
- a copy of the Partial with this field set to its maximum
- Since:
- 1.2
-
withMinimumValue
Returns a new Partial with this field set to the minimum value for this field.The Partial attached to this property is unchanged by this call.
- Returns:
- a copy of the Partial with this field set to its minimum
- Since:
- 1.2
-