public static final class LocalTime.Property extends AbstractReadableInstantFieldProperty
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.
Modifier and Type | Method and Description |
---|---|
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.
|
DateTimeField |
getField()
Gets the field being used.
|
LocalTime |
getLocalTime()
Gets the LocalTime object linked to this property.
|
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(java.lang.String text)
Sets this field in a copy of the LocalTime to a parsed text value.
|
LocalTime |
setCopy(java.lang.String text,
java.util.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.
|
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
public DateTimeField getField()
getField
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 copypublic 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 copypublic 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 copyjava.lang.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 copyjava.lang.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 tojava.lang.IllegalArgumentException
- if the value isn't validpublic LocalTime setCopy(java.lang.String text, java.util.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 symboljava.lang.IllegalArgumentException
- if the text value isn't validpublic LocalTime setCopy(java.lang.String text)
The LocalTime attached to this property is unchanged by this call.
text
- the text value to setjava.lang.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()
"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"