Class ISOChronology.AmPmOfDayRule

    • Constructor Detail

      • AmPmOfDayRule

        private AmPmOfDayRule()
        Constructor.
    • Method Detail

      • readResolve

        private java.lang.Object readResolve()
      • derive

        protected AmPmOfDay 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 class CalendricalRule<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: DateTimeFieldRule
        Converts the typed value of the rule to the int equivalent.

        This default implementation handles Integer and Enum. When the reified type is another type, this method must be overridden.

        Overrides:
        convertValueToInt in class DateTimeFieldRule<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: DateTimeFieldRule
        Converts the int to a typed value of the rule.

        The int will be checked to ensure that it is within the valid range of values for the field.

        This default implementation handles Integer and Enum. When the reified type is another type, this method must be overridden.

        Overrides:
        convertIntToValue in class DateTimeFieldRule<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: CalendricalRule
        Interprets 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:
        interpret in class CalendricalRule<AmPmOfDay>
        Parameters:
        merger - the merger instance controlling the merge process, not null
        value - the value to interpret, null if unable to interpret the value
        Returns:
        the interpreted value