Class ISOChronology.AmPmOfDayRule
- java.lang.Object
-
- javax.time.calendar.CalendricalRule<T>
-
- javax.time.calendar.DateTimeFieldRule<AmPmOfDay>
-
- javax.time.calendar.ISOChronology.AmPmOfDayRule
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<CalendricalRule<?>>,java.util.Comparator<Calendrical>
- Enclosing class:
- ISOChronology
static final class ISOChronology.AmPmOfDayRule extends DateTimeFieldRule<AmPmOfDay> 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 (package private) static DateTimeFieldRule<AmPmOfDay>INSTANCESingleton instance.private static longserialVersionUIDA serialization identifier for this class.
-
Constructor Summary
Constructors Modifier Constructor Description privateAmPmOfDayRule()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AmPmOfDayconvertIntToValue(int value)Converts theintto a typed value of the rule.intconvertValueToInt(AmPmOfDay value)Converts the typed value of the rule to theintequivalent.protected voidcreateTextStores(java.util.EnumMap<DateTimeFormatterBuilder.TextStyle,DateTimeFieldRule.TextStore> textStores, java.util.Locale locale)Creates the text store for each style for the specified locale.protected AmPmOfDayderive(Calendrical calendrical)Derives the value of this rule from a calendrical.protected AmPmOfDayinterpret(CalendricalMerger merger, java.lang.Object value)Interprets the specified value converting it into an in range value of the correct type for this rule.private java.lang.ObjectreadResolve()-
Methods inherited from class javax.time.calendar.DateTimeFieldRule
checkValue, checkValue, convertFractionToInt, convertIntToFraction, 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, interpretValue, merge, reify, toString
-
-
-
-
Field Detail
-
INSTANCE
static final DateTimeFieldRule<AmPmOfDay> INSTANCE
Singleton instance.
-
serialVersionUID
private static final long serialVersionUID
A serialization identifier for this class.- See Also:
- Constant Field Values
-
-
Method Detail
-
readResolve
private java.lang.Object readResolve()
-
derive
protected AmPmOfDay derive(Calendrical calendrical)
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(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:
derivein classCalendricalRule<AmPmOfDay>- Parameters:
calendrical- the calendrical to derive from, not null- Returns:
- the derived value, null if unable to derive
-
convertValueToInt
public int convertValueToInt(AmPmOfDay value)
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<AmPmOfDay>- Parameters:
value- the value to convert, not null- Returns:
- the int value of the field
-
convertIntToValue
public AmPmOfDay convertIntToValue(int value)
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<AmPmOfDay>- Parameters:
value- the value to convert, not null- Returns:
- the int value of the field
-
interpret
protected AmPmOfDay interpret(CalendricalMerger merger, java.lang.Object value)
Description copied from class:CalendricalRuleInterprets the specified value converting it into an in range value of the correct type for this rule.Before this method is called, the value will be checked to ensure it is not of the type of this rule.
- Overrides:
interpretin classCalendricalRule<AmPmOfDay>- Parameters:
merger- the merger instance controlling the merge process, not nullvalue- the value to interpret, null if unable to interpret the value- Returns:
- the interpreted value
-
createTextStores
protected void createTextStores(java.util.EnumMap<DateTimeFormatterBuilder.TextStyle,DateTimeFieldRule.TextStore> textStores, java.util.Locale locale)
Description copied from class:DateTimeFieldRuleCreates the text store for each style for the specified locale.It is intended that a new copy of the text store should be created in response to calling this method as the result is cached by
DateTimeFieldRule.getTextStore(java.util.Locale, javax.time.calendar.format.DateTimeFormatterBuilder.TextStyle).- Overrides:
createTextStoresin classDateTimeFieldRule<AmPmOfDay>- Parameters:
textStores- the map to populate with TextStore instances, not nulllocale- the locale to use, not null
-
-