Class CopticChronology.DayOfMonthRule
- All Implemented Interfaces:
Serializable, Comparable<CalendricalRule<?>>, Comparator<Calendrical>
- Enclosing class:
CopticChronology
-
Nested Class Summary
Nested classes/interfaces inherited from class DateTimeFieldRule
DateTimeFieldRule.TextStore -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final DateTimeFieldRule<Integer> Singleton instance.private static final longA serialization identifier for this class. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Integerderive(Calendrical calendrical) Derives the value of this rule from a calendrical.intgetMaximumValue(Calendrical calendrical) Gets the minimum value that the field can take using the specified calendrical information to refine the accuracy of the response.intGets the smallest possible maximum value that the field can take.private ObjectMethods inherited from class DateTimeFieldRule
checkValue, checkValue, convertFractionToInt, convertIntToFraction, convertIntToValue, convertValueToInt, createTextStores, getInt, getInteger, getLargestMinimumValue, getMaximumValue, getMinimumValue, getMinimumValue, getText, getTextStore, isFixedValueSet, isValidValue, isValidValueMethods inherited from class CalendricalRule
compare, compareTo, deriveValueFor, deriveValueFrom, equals, getChronology, getID, getName, getPeriodRange, getPeriodUnit, getReifiedType, getValue, getValueChecked, hashCode, interpret, 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
-
DayOfMonthRule
private DayOfMonthRule()Constructor.
-
-
Method Details
-
readResolve
-
getSmallestMaximumValue
public int getSmallestMaximumValue()Description copied from class:DateTimeFieldRuleGets the smallest possible maximum value that the field can take.The default implementation returns
DateTimeFieldRule.getMaximumValue(). Subclasses must override this as necessary.- Overrides:
getSmallestMaximumValuein classDateTimeFieldRule<Integer>- Returns:
- the smallest possible maximum value for this field
-
getMaximumValue
Description copied from class:DateTimeFieldRuleGets the minimum value that the field can take using the specified calendrical information to refine the accuracy of the response.The result of this method will still be inaccurate if there is insufficient information in the calendrical.
For example, if this field is the ISO day-of-month field, then the number of days in the month varies depending on the month and year. If both the month and year can be derived from the calendrical, then the maximum value returned will be accurate. Otherwise the 'best guess' value from
DateTimeFieldRule.getMaximumValue()will be returned.The default implementation returns
DateTimeFieldRule.getMaximumValue(). Subclasses must override this as necessary.- Overrides:
getMaximumValuein classDateTimeFieldRule<Integer>- Parameters:
calendrical- context calendrical, not null- Returns:
- the minimum value of the field given the context
-
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<Integer>- Parameters:
calendrical- the calendrical to derive from, not null- Returns:
- the derived value, null if unable to derive
-