public final class SecondOfMinute extends java.lang.Object implements Calendrical, java.lang.Comparable<SecondOfMinute>, TimeAdjuster, CalendricalMatcher, java.io.Serializable
SecondOfMinute is an immutable time field that can only store a second-of-minute. It is a type-safe way of representing a second-of-minute in an application.
Static factory methods allow you to construct instances. The second-of-minute may be queried using getValue().
SecondOfMinute is immutable and thread-safe.
Modifier and Type | Method and Description |
---|---|
LocalTime |
adjustTime(LocalTime time)
Adjusts a time to have the the second-of-minute represented by this object,
returning a new time.
|
int |
compareTo(SecondOfMinute otherSecondOfMinute)
Compares this second-of-minute instance to another.
|
boolean |
equals(java.lang.Object otherSecondOfMinute)
Is this instance equal to that specified, evaluating the second-of-minute.
|
<T> T |
get(CalendricalRule<T> rule)
Gets the value of the specified calendrical rule.
|
int |
getValue()
Gets the second-of-minute value.
|
int |
hashCode()
A hash code for the second-of-minute object.
|
boolean |
matchesCalendrical(Calendrical calendrical)
Checks if the second-of-minute extracted from the calendrical matches this.
|
static DateTimeFieldRule<java.lang.Integer> |
rule()
Gets the rule that defines how the second-of-minute field operates.
|
static SecondOfMinute |
secondOfMinute(Calendrical calendrical)
Obtains an instance of
SecondOfMinute from a calendrical. |
static SecondOfMinute |
secondOfMinute(int secondOfMinute)
Obtains an instance of
SecondOfMinute . |
java.lang.String |
toString()
A string describing the second-of-minute 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 SecondOfMinute secondOfMinute(int secondOfMinute)
SecondOfMinute
.secondOfMinute
- the second-of-minute to represent, from 0 to 59IllegalCalendarFieldValueException
- if the secondOfMinute is invalidpublic static SecondOfMinute secondOfMinute(Calendrical calendrical)
SecondOfMinute
from a calendrical.
This can be used extract the second-of-minute value directly from any implementation
of Calendrical
, including those in other calendar systems.
calendrical
- the calendrical to extract from, not nullUnsupportedRuleException
- if the second-of-minute 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 second-of-minute 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(SecondOfMinute otherSecondOfMinute)
compareTo
in interface java.lang.Comparable<SecondOfMinute>
otherSecondOfMinute
- the other second-of-minute instance, not nulljava.lang.NullPointerException
- if otherSecondOfMinute is nullpublic boolean equals(java.lang.Object otherSecondOfMinute)
equals
in class java.lang.Object
otherSecondOfMinute
- the other second-of-minute instance, null returns falsepublic int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object