Class ZoneOffset.Rule
- All Implemented Interfaces:
Serializable
,Comparable<CalendricalRule<?>>
,Comparator<Calendrical>
- Enclosing class:
- ZoneOffset
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final CalendricalRule<ZoneOffset>
private static final long
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ZoneOffset
derive
(Calendrical calendrical) Derives the value of this rule from a calendrical.private Object
Methods inherited from class javax.time.calendar.CalendricalRule
compare, compareTo, deriveValueFor, deriveValueFrom, equals, getChronology, getID, getName, getPeriodRange, getPeriodUnit, getReifiedType, getValue, getValueChecked, hashCode, interpret, interpretValue, merge, reify, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Field Details
-
INSTANCE
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
-
Constructor Details
-
Rule
private Rule()
-
-
Method Details
-
readResolve
-
derive
Description copied from class:CalendricalRule
Derives the value of this rule from a calendrical.This method derives the value for this field from other fields in the calendrical without directly querying the calendrical for the value.
For example, if this field is quarter-of-year, then the value can be derived from month-of-year.
The implementation only needs to derive the value based on its immediate parents. The use of
Calendrical.get(javax.time.calendar.CalendricalRule<T>)
will extract any further parents on demand.A typical implementation of this method obtains the parent value and performs a calculation. For example, here is a simple implementation for the quarter-of-year field:
Integer moyVal = calendrical.get(ISOChronology.monthOfYearRule()); return (moyVal != null ? ((moyVal - 1) % 4) + 1) : null;
This method is designed to be overridden in subclasses. The subclass implementation must be thread-safe. The subclass implementation must not request the value of this rule from the specified calendrical, otherwise a stack overflow error will occur.
- Overrides:
derive
in classCalendricalRule<ZoneOffset>
- Parameters:
calendrical
- the calendrical to derive from, not null- Returns:
- the derived value, null if unable to derive
-