Class ISOChronology.Unit
java.lang.Object
javax.time.calendar.PeriodUnit
javax.time.calendar.ISOChronology.Unit
- All Implemented Interfaces:
Serializable, Comparable<PeriodUnit>
- Enclosing class:
ISOChronology
Single unit subclass, which means fewer classes to load at startup.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intprivate static final long -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateUnit(int ordinal, String name, PeriodField equivalentPeriod, Duration estimatedDuration) -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(PeriodUnit other) Compares this unit to another.booleanCompares two units based on the name, estimated duration and equivalent period.inthashCode()Returns a hash code based on the name, estimated duration and equivalent period.private ObjectMethods inherited from class PeriodUnit
getBaseUnit, getEquivalentPeriod, getEquivalentPeriods, getEstimatedDuration, getName, isConvertibleTo, toString
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
ordinal
private final int ordinal
-
-
Constructor Details
-
Unit
-
-
Method Details
-
readResolve
-
compareTo
Description copied from class:PeriodUnitCompares this unit to another.The comparison is based primarily on the
estimated duration. If that is equal, the name is compared using standard string comparison. Finally, the first equivalent period is checked, with basic units before derived ones.- Specified by:
compareToin interfaceComparable<PeriodUnit>- Overrides:
compareToin classPeriodUnit- Parameters:
other- the other type to compare to, not null- Returns:
- the comparator result, negative if less, positive if greater, zero if equal
-
equals
Description copied from class:PeriodUnitCompares two units based on the name, estimated duration and equivalent period.- Overrides:
equalsin classPeriodUnit- Parameters:
obj- the object to compare to, null returns false- Returns:
- true if the units are the same
-
hashCode
public int hashCode()Description copied from class:PeriodUnitReturns a hash code based on the name, estimated duration and equivalent period.- Overrides:
hashCodein classPeriodUnit- Returns:
- a suitable hash code
-