public static final class MutableDateTime.Property extends AbstractReadableInstantFieldProperty
The example below shows how to use the property to change the value of a MutableDateTime object.
MutableDateTime dt = new MutableDateTime(1972, 12, 3, 13, 32, 19, 123); dt.year().add(20); dt.second().roundFloor().minute().set(10);
MutableDateTime.Propery itself is thread-safe and immutable, but the MutableDateTime being operated on is not.
Modifier and Type | Field and Description |
---|---|
private DateTimeField |
iField
The field this property is working against
|
private MutableDateTime |
iInstant
The instant this property is working against
|
private static long |
serialVersionUID
Serialization version
|
Constructor and Description |
---|
Property(MutableDateTime instant,
DateTimeField field)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
MutableDateTime |
add(int value)
Adds a value to the millis value.
|
MutableDateTime |
add(long value)
Adds a value to the millis value.
|
MutableDateTime |
addWrapField(int value)
Adds a value, possibly wrapped, to the millis value.
|
protected Chronology |
getChronology()
Gets the chronology of the datetime that this property is linked to.
|
DateTimeField |
getField()
Gets the field being used.
|
protected long |
getMillis()
Gets the milliseconds of the datetime that this property is linked to.
|
MutableDateTime |
getMutableDateTime()
Gets the mutable datetime being used.
|
private void |
readObject(java.io.ObjectInputStream oos)
Reads the property from a safe serialization format.
|
MutableDateTime |
roundCeiling()
Round to the highest whole unit of this field.
|
MutableDateTime |
roundFloor()
Round to the lowest whole unit of this field.
|
MutableDateTime |
roundHalfCeiling()
Round to the nearest whole unit of this field, favoring the ceiling if
halfway.
|
MutableDateTime |
roundHalfEven()
Round to the nearest whole unit of this field.
|
MutableDateTime |
roundHalfFloor()
Round to the nearest whole unit of this field, favoring the floor if
halfway.
|
MutableDateTime |
set(int value)
Sets a value.
|
MutableDateTime |
set(java.lang.String text)
Sets a text value.
|
MutableDateTime |
set(java.lang.String text,
java.util.Locale locale)
Sets a text value.
|
private void |
writeObject(java.io.ObjectOutputStream oos)
Writes the property in a safe serialization format.
|
compareTo, compareTo, equals, get, getAsShortText, getAsShortText, getAsString, getAsText, getAsText, getDifference, getDifferenceAsLong, getDurationField, getFieldType, getLeapAmount, getLeapDurationField, getMaximumShortTextLength, getMaximumTextLength, getMaximumValue, getMaximumValueOverall, getMinimumValue, getMinimumValueOverall, getName, getRangeDurationField, hashCode, isLeap, remainder, toInterval, toString
private static final long serialVersionUID
private MutableDateTime iInstant
private DateTimeField iField
Property(MutableDateTime instant, DateTimeField field)
instant
- the instant to setfield
- the field to useprivate void writeObject(java.io.ObjectOutputStream oos) throws java.io.IOException
java.io.IOException
private void readObject(java.io.ObjectInputStream oos) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
public DateTimeField getField()
getField
in class AbstractReadableInstantFieldProperty
protected long getMillis()
getMillis
in class AbstractReadableInstantFieldProperty
protected Chronology getChronology()
getChronology
in class AbstractReadableInstantFieldProperty
public MutableDateTime getMutableDateTime()
public MutableDateTime add(int value)
value
- the value to addDateTimeField.add(long,int)
public MutableDateTime add(long value)
value
- the value to addDateTimeField.add(long,long)
public MutableDateTime addWrapField(int value)
value
- the value to addDateTimeField.addWrapField(long, int)
public MutableDateTime set(int value)
value
- the value to set.DateTimeField.set(long,int)
public MutableDateTime set(java.lang.String text, java.util.Locale locale)
text
- the text value to setlocale
- optional locale to use for selecting a text symboljava.lang.IllegalArgumentException
- if the text value isn't validDateTimeField.set(long,java.lang.String,java.util.Locale)
public MutableDateTime set(java.lang.String text)
text
- the text value to setjava.lang.IllegalArgumentException
- if the text value isn't validDateTimeField.set(long,java.lang.String)
public MutableDateTime roundFloor()
DateTimeField.roundFloor(long)
public MutableDateTime roundCeiling()
DateTimeField.roundCeiling(long)
public MutableDateTime roundHalfFloor()
DateTimeField.roundHalfFloor(long)
public MutableDateTime roundHalfCeiling()
DateTimeField.roundHalfCeiling(long)
public MutableDateTime roundHalfEven()
DateTimeField.roundHalfEven(long)