Class ISOChronology.QuarterOfYearRule
- All Implemented Interfaces:
Serializable, Comparable<CalendricalRule<?>>, Comparator<Calendrical>
- Enclosing class:
ISOChronology
-
Nested Class Summary
Nested classes/interfaces inherited from class DateTimeFieldRule
DateTimeFieldRule.TextStore -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final DateTimeFieldRule<QuarterOfYear> Singleton instance.private static final longA serialization identifier for this class. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconvertIntToValue(int value) Converts theintto a typed value of the rule.intconvertValueToInt(QuarterOfYear value) Converts the typed value of the rule to theintequivalent.protected QuarterOfYearderive(Calendrical calendrical) Derives the value of this rule from a calendrical.private ObjectMethods inherited from class DateTimeFieldRule
checkValue, checkValue, convertFractionToInt, convertIntToFraction, createTextStores, getInt, getInteger, getLargestMinimumValue, getMaximumValue, getMaximumValue, getMinimumValue, getMinimumValue, getSmallestMaximumValue, getText, getTextStore, isFixedValueSet, isValidValue, isValidValueMethods inherited from class CalendricalRule
compare, compareTo, deriveValueFor, deriveValueFrom, equals, getChronology, getID, getName, getPeriodRange, getPeriodUnit, getReifiedType, getValue, getValueChecked, hashCode, interpret, interpretValue, merge, reify, toStringMethods inherited from interface Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Field Details
-
INSTANCE
Singleton instance. -
serialVersionUID
private static final long serialVersionUIDA serialization identifier for this class.- See Also:
-
-
Constructor Details
-
QuarterOfYearRule
private QuarterOfYearRule()Constructor.
-
-
Method Details
-
readResolve
-
derive
Description copied from class:CalendricalRuleDerives 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(CalendricalRule)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:
derivein classCalendricalRule<QuarterOfYear>- Parameters:
calendrical- the calendrical to derive from, not null- Returns:
- the derived value, null if unable to derive
-
convertValueToInt
Description copied from class:DateTimeFieldRuleConverts the typed value of the rule to theintequivalent.This default implementation handles
IntegerandEnum. When the reified type is another type, this method must be overridden.- Overrides:
convertValueToIntin classDateTimeFieldRule<QuarterOfYear>- Parameters:
value- the value to convert, not null- Returns:
- the int value of the field
-
convertIntToValue
Description copied from class:DateTimeFieldRuleConverts theintto a typed value of the rule.The
intwill be checked to ensure that it is within the valid range of values for the field.This default implementation handles
IntegerandEnum. When the reified type is another type, this method must be overridden.- Overrides:
convertIntToValuein classDateTimeFieldRule<QuarterOfYear>- Parameters:
value- the value to convert, not null- Returns:
- the int value of the field
-