java.lang.Object | ||
↳ | org.joda.time.field.AbstractReadableInstantFieldProperty | |
↳ | org.joda.time.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.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Adds to this field in a copy of this LocalTime.
| |||||||||||
Adds to this field in a copy of this LocalTime.
| |||||||||||
Adds to this field in a copy of this LocalTime.
| |||||||||||
Adds to this field, possibly wrapped, in a copy of this LocalTime.
| |||||||||||
Gets the field being used.
| |||||||||||
Gets the LocalTime object linked to this property.
| |||||||||||
Rounds to the highest whole unit of this field on a copy of this
LocalTime.
| |||||||||||
Rounds to the lowest whole unit of this field on a copy of this
LocalTime.
| |||||||||||
Rounds to the nearest whole unit of this field on a copy of this
LocalTime, favoring the ceiling if halfway.
| |||||||||||
Rounds to the nearest whole unit of this field on a copy of this
LocalTime.
| |||||||||||
Rounds to the nearest whole unit of this field on a copy of this
LocalTime, favoring the floor if halfway.
| |||||||||||
Sets this field in a copy of the LocalTime to a parsed text value.
| |||||||||||
Sets this field in a copy of the LocalTime.
| |||||||||||
Sets this field in a copy of the LocalTime to a parsed text value.
| |||||||||||
Returns a new LocalTime with this field set to the maximum value
for this field.
| |||||||||||
Returns a new LocalTime with this field set to the minimum value
for this field.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Gets the chronology of the datetime that this property is linked to.
| |||||||||||
Gets the milliseconds of the time that this property is linked to.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.joda.time.field.AbstractReadableInstantFieldProperty
| |||||||||||
From class
java.lang.Object
|
Adds to this field in a copy of this LocalTime. If the addition exceeds the maximum value (eg. 23:59) it will wrap to the minimum value (eg. 00:00).
The LocalTime attached to this property is unchanged by this call.
value | the value to add to the field in the copy |
---|
Adds to this field in a copy of this LocalTime.
The LocalTime attached to this property is unchanged by this call.
value | the value to add to the field in the copy |
---|
Adds to this field in a copy of this LocalTime.
If the addition exceeds the maximum value (eg. 23:59) then
an exception will be thrown.
Contrast this behaviour to 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 invalid |
---|
Adds to this field, possibly wrapped, in a copy of this LocalTime. A field wrapped operation only changes this field. Thus 10:59 plusWrapField one minute goes to 10:00.
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 valid |
---|
Gets the LocalTime object linked to this property.
Rounds to the highest whole unit of this field on a copy of this LocalTime.
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.
Rounds to the lowest whole unit of this field on a copy of this LocalTime.
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.
Rounds to the nearest whole unit of this field on a copy of this LocalTime, favoring the ceiling if halfway.
Rounds to the nearest whole unit of this field on a copy of this LocalTime. If halfway, the ceiling is favored over the floor only if it makes this field's value even.
Rounds to the nearest whole unit of this field on a copy of this LocalTime, favoring the floor if halfway.
Sets this field in a copy of the LocalTime to a parsed text value.
The LocalTime attached to this property is unchanged by this call.
text | the text value to set |
---|---|
locale | optional locale to use for selecting a text symbol |
IllegalArgumentException | if the text value isn't valid |
---|
Sets this field in a copy of the LocalTime.
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 valid |
---|
Sets this field in a copy of the LocalTime to a parsed text value.
The LocalTime attached to this property is unchanged by this call.
text | the text value to set |
---|
IllegalArgumentException | if the text value isn't valid |
---|
Returns a new LocalTime with this field set to the maximum value for this field.
The LocalTime attached to this property is unchanged by this call.
Returns a new LocalTime with this field set to the minimum value for this field.
The LocalTime attached to this property is unchanged by this call.
Gets the chronology of the datetime that this property is linked to.
Gets the milliseconds of the time that this property is linked to.