public final class MinuteOfHour extends java.lang.Object implements Calendrical, java.lang.Comparable<MinuteOfHour>, TimeAdjuster, CalendricalMatcher, java.io.Serializable
MinuteOfHour is an immutable time field that can only store a minute-of-hour. It is a type-safe way of representing a minute-of-hour in an application.
Static factory methods allow you to construct instances. The minute-of-hour may be queried using getValue().
MinuteOfHour is immutable and thread-safe.
Modifier and Type | Method and Description |
---|---|
LocalTime |
adjustTime(LocalTime time)
Adjusts a time to have the the minute-of-hour represented by this object,
returning a new time.
|
int |
compareTo(MinuteOfHour otherMinuteOfHour)
Compares this minute-of-hour instance to another.
|
boolean |
equals(java.lang.Object otherMinuteOfHour)
Is this instance equal to that specified, evaluating the minute-of-hour.
|
<T> T |
get(CalendricalRule<T> rule)
Gets the value of the specified calendrical rule.
|
int |
getValue()
Gets the minute-of-hour value.
|
int |
hashCode()
A hash code for the minute-of-hour object.
|
boolean |
matchesCalendrical(Calendrical calendrical)
Checks if the minute-of-hour extracted from the calendrical matches this.
|
static MinuteOfHour |
minuteOfHour(Calendrical calendrical)
Obtains an instance of
MinuteOfHour from a calendrical. |
static MinuteOfHour |
minuteOfHour(int minuteOfHour)
Obtains an instance of
MinuteOfHour . |
static DateTimeFieldRule<java.lang.Integer> |
rule()
Gets the rule that defines how the minute-of-hour field operates.
|
java.lang.String |
toString()
A string describing the minute-of-hour object.
|
public static DateTimeFieldRule<java.lang.Integer> rule()
The rule provides access to the minimum and maximum values, and a generic way to access values within a calendrical.
public static MinuteOfHour minuteOfHour(int minuteOfHour)
MinuteOfHour
.minuteOfHour
- the minute-of-hour to represent, from 0 to 59IllegalCalendarFieldValueException
- if the minuteOfHour is invalidpublic static MinuteOfHour minuteOfHour(Calendrical calendrical)
MinuteOfHour
from a calendrical.
This can be used extract the minute-of-hour value directly from any implementation
of Calendrical
, including those in other calendar systems.
calendrical
- the calendrical to extract from, not nullUnsupportedRuleException
- if the minute-of-hour cannot be obtainedpublic <T> T get(CalendricalRule<T> rule)
This method queries the value of the specified calendrical rule.
If the value cannot be returned for the rule from this instance then
null
will be returned.
get
in interface Calendrical
rule
- the rule to use, not nullpublic int getValue()
public boolean matchesCalendrical(Calendrical calendrical)
matchesCalendrical
in interface CalendricalMatcher
calendrical
- the calendrical to match, not nullpublic LocalTime adjustTime(LocalTime time)
Only the minute-of-hour field is adjusted in the result. The other time fields are unaffected.
This instance is immutable and unaffected by this method call.
adjustTime
in interface TimeAdjuster
time
- the time to be adjusted, not nullpublic int compareTo(MinuteOfHour otherMinuteOfHour)
compareTo
in interface java.lang.Comparable<MinuteOfHour>
otherMinuteOfHour
- the other minute-of-hour instance, not nulljava.lang.NullPointerException
- if otherMinuteOfHour is nullpublic boolean equals(java.lang.Object otherMinuteOfHour)
equals
in class java.lang.Object
otherMinuteOfHour
- the other minute-of-hour instance, null returns falsepublic int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object