Class HistoricChronology.MonthOfYearRule
- java.lang.Object
-
- javax.time.calendar.CalendricalRule<T>
-
- javax.time.calendar.DateTimeFieldRule<MonthOfYear>
-
- javax.time.i18n.HistoricChronology.MonthOfYearRule
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<CalendricalRule<?>>
,java.util.Comparator<Calendrical>
- Enclosing class:
- HistoricChronology
private static final class HistoricChronology.MonthOfYearRule extends DateTimeFieldRule<MonthOfYear> implements java.io.Serializable
Rule implementation.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.time.calendar.DateTimeFieldRule
DateTimeFieldRule.TextStore
-
-
Field Summary
Fields Modifier and Type Field Description private HistoricChronology
chrono
The chronology.private static long
serialVersionUID
A serialization identifier for this class.
-
Constructor Summary
Constructors Modifier Constructor Description private
MonthOfYearRule(HistoricChronology chrono)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected MonthOfYear
derive(Calendrical calendrical)
Derives the value of this rule from a calendrical.-
Methods inherited from class javax.time.calendar.DateTimeFieldRule
checkValue, checkValue, convertFractionToInt, convertIntToFraction, convertIntToValue, convertValueToInt, createTextStores, getInt, getInteger, getLargestMinimumValue, getMaximumValue, getMaximumValue, getMinimumValue, getMinimumValue, getSmallestMaximumValue, getText, getTextStore, isFixedValueSet, isValidValue, isValidValue
-
Methods inherited from class javax.time.calendar.CalendricalRule
compare, compareTo, deriveValueFor, deriveValueFrom, equals, getChronology, getID, getName, getPeriodRange, getPeriodUnit, getReifiedType, getValue, getValueChecked, hashCode, interpret, merge, reify, toString
-
-
-
-
Field Detail
-
chrono
private final HistoricChronology chrono
The chronology.
-
serialVersionUID
private static final long serialVersionUID
A serialization identifier for this class.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MonthOfYearRule
private MonthOfYearRule(HistoricChronology chrono)
Constructor.
-
-
Method Detail
-
derive
protected MonthOfYear derive(Calendrical calendrical)
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<MonthOfYear>
- Parameters:
calendrical
- the calendrical to derive from, not null- Returns:
- the derived value, null if unable to derive
-
-