|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.joda.time.field.AbstractReadableInstantFieldProperty org.joda.time.LocalTime.Property
public static final class LocalTime.Property
LocalTime.Property binds a LocalTime to a DateTimeField allowing powerful datetime functionality to be easily accessed.
The simplest use of this class is as an alternative get method, here used to get the minute '30'.
LocalTime dt = new LocalTime(12, 30); int year = dt.minuteOfHour().get();
Methods are also provided that allow time modification. These return new instances of LocalTime - they do not modify the original. The example below yields two independent immutable date objects 2 hours apart.
LocalTime dt1230 = new LocalTime(12, 30); LocalTime dt1430 = dt1230.hourOfDay().setCopy(14);
LocalTime.Property itself is thread-safe and immutable, as well as the LocalTime being operated on.
Method Summary | |
---|---|
LocalTime |
addCopy(int value)
Adds to this field in a copy of this LocalTime. |
LocalTime |
addCopy(long value)
Adds to this field in a copy of this LocalTime. |
LocalTime |
addNoWrapToCopy(int value)
Adds to this field in a copy of this LocalTime. |
LocalTime |
addWrapFieldToCopy(int value)
Adds to this field, possibly wrapped, in a copy of this LocalTime. |
protected Chronology |
getChronology()
Gets the chronology of the datetime that this property is linked to. |
DateTimeField |
getField()
Gets the field being used. |
LocalTime |
getLocalTime()
Gets the LocalTime object linked to this property. |
protected long |
getMillis()
Gets the milliseconds of the time that this property is linked to. |
LocalTime |
roundCeilingCopy()
Rounds to the highest whole unit of this field on a copy of this LocalTime. |
LocalTime |
roundFloorCopy()
Rounds to the lowest whole unit of this field on a copy of this LocalTime. |
LocalTime |
roundHalfCeilingCopy()
Rounds to the nearest whole unit of this field on a copy of this LocalTime, favoring the ceiling if halfway. |
LocalTime |
roundHalfEvenCopy()
Rounds to the nearest whole unit of this field on a copy of this LocalTime. |
LocalTime |
roundHalfFloorCopy()
Rounds to the nearest whole unit of this field on a copy of this LocalTime, favoring the floor if halfway. |
LocalTime |
setCopy(int value)
Sets this field in a copy of the LocalTime. |
LocalTime |
setCopy(String text)
Sets this field in a copy of the LocalTime to a parsed text value. |
LocalTime |
setCopy(String text,
Locale locale)
Sets this field in a copy of the LocalTime to a parsed text value. |
LocalTime |
withMaximumValue()
Returns a new LocalTime with this field set to the maximum value for this field. |
LocalTime |
withMinimumValue()
Returns a new LocalTime with this field set to the minimum value for this field. |
Methods inherited from class org.joda.time.field.AbstractReadableInstantFieldProperty |
---|
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 |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public DateTimeField getField()
getField
in class AbstractReadableInstantFieldProperty
protected long getMillis()
getMillis
in class AbstractReadableInstantFieldProperty
protected Chronology getChronology()
getChronology
in class AbstractReadableInstantFieldProperty
public LocalTime getLocalTime()
public LocalTime addCopy(int value)
The LocalTime attached to this property is unchanged by this call.
value
- the value to add to the field in the copy
public LocalTime addCopy(long value)
The LocalTime attached to this property is unchanged by this call.
value
- the value to add to the field in the copy
public LocalTime addNoWrapToCopy(int value)
addCopy(int)
.
The LocalTime attached to this property is unchanged by this call.
value
- the value to add to the field in the copy
IllegalArgumentException
- if the result is invalidpublic LocalTime addWrapFieldToCopy(int value)
The LocalTime attached to this property is unchanged by this call.
value
- the value to add to the field in the copy
IllegalArgumentException
- if the value isn't validpublic LocalTime setCopy(int value)
The LocalTime attached to this property is unchanged by this call.
value
- the value to set the field in the copy to
IllegalArgumentException
- if the value isn't validpublic LocalTime setCopy(String text, Locale locale)
The LocalTime attached to this property is unchanged by this call.
text
- the text value to setlocale
- optional locale to use for selecting a text symbol
IllegalArgumentException
- if the text value isn't validpublic LocalTime setCopy(String text)
The LocalTime attached to this property is unchanged by this call.
text
- the text value to set
IllegalArgumentException
- if the text value isn't validpublic LocalTime withMaximumValue()
The LocalTime attached to this property is unchanged by this call.
public LocalTime withMinimumValue()
The LocalTime attached to this property is unchanged by this call.
public LocalTime roundFloorCopy()
For example, rounding floor on the hourOfDay field of a LocalTime where the time is 10:30 would result in new LocalTime with the time of 10:00.
public LocalTime roundCeilingCopy()
For example, rounding floor on the hourOfDay field of a LocalTime where the time is 10:30 would result in new LocalTime with the time of 11:00.
public LocalTime roundHalfFloorCopy()
public LocalTime roundHalfCeilingCopy()
public LocalTime roundHalfEvenCopy()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |