Class YearMonth.Property
- java.lang.Object
-
- org.joda.time.field.AbstractPartialFieldProperty
-
- org.joda.time.YearMonth.Property
-
- All Implemented Interfaces:
java.io.Serializable
- Enclosing class:
- YearMonth
public static class YearMonth.Property extends AbstractPartialFieldProperty implements java.io.Serializable
The property class forYearMonth.This class binds a
YearMonthto aDateTimeField.- Since:
- 2.0
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description YearMonthaddToCopy(int valueToAdd)Adds to the value of this field in a copy of this YearMonth.YearMonthaddWrapFieldToCopy(int valueToAdd)Adds to the value of this field in a copy of this YearMonth wrapping within this field if the maximum value is reached.intget()Gets the value of this field.DateTimeFieldgetField()Gets the field that this property uses.YearMonthgetYearMonth()Gets the partial that this property belongs to.YearMonthsetCopy(int value)Sets this field in a copy of the YearMonth.YearMonthsetCopy(java.lang.String text)Sets this field in a copy of the YearMonth to a parsed text value.YearMonthsetCopy(java.lang.String text, java.util.Locale locale)Sets this field in a copy of the YearMonth to a parsed text value.-
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 Detail
-
getField
public DateTimeField getField()
Gets the field that this property uses.- Specified by:
getFieldin classAbstractPartialFieldProperty- Returns:
- the field
-
getYearMonth
public YearMonth getYearMonth()
Gets the partial that this property belongs to.- Returns:
- the partial
-
get
public int get()
Gets the value of this field.- Specified by:
getin classAbstractPartialFieldProperty- Returns:
- the field value
-
addToCopy
public YearMonth addToCopy(int valueToAdd)
Adds to the value of this field in a copy of this YearMonth.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 YearMonth 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 YearMonth with the field value changed
- Throws:
java.lang.IllegalArgumentException- if the value isn't valid
-
addWrapFieldToCopy
public YearMonth addWrapFieldToCopy(int valueToAdd)
Adds to the value of this field in a copy of this YearMonth 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-12addWrapField one month returns2004-01.The YearMonth 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 YearMonth with the field value changed
- Throws:
java.lang.IllegalArgumentException- if the value isn't valid
-
setCopy
public YearMonth setCopy(int value)
Sets this field in a copy of the YearMonth.The YearMonth 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 YearMonth with the field value changed
- Throws:
java.lang.IllegalArgumentException- if the value isn't valid
-
setCopy
public YearMonth setCopy(java.lang.String text, java.util.Locale locale)
Sets this field in a copy of the YearMonth to a parsed text value.The YearMonth 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 YearMonth with the field value changed
- Throws:
java.lang.IllegalArgumentException- if the text value isn't valid
-
setCopy
public YearMonth setCopy(java.lang.String text)
Sets this field in a copy of the YearMonth to a parsed text value.The YearMonth 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 YearMonth with the field value changed
- Throws:
java.lang.IllegalArgumentException- if the text value isn't valid
-
-