Interface NumericalElement<V extends Enum<V>>

Type Parameters:
V - generic type of element values (will be adjusted to enum-supertype in next major release)
All Superinterfaces:
ChronoElement<V>, Comparator<ChronoDisplay>

public interface NumericalElement<V extends Enum<V>> extends ChronoElement<V>

A chronological element which allows a numerical representation.

This element interface is only relevant for enum-like elements.

Author:
Meno Hochschild
  • Method Details

    • numerical

      int numerical(V value)

      Translates given element value to a numerical integer.

      Will be called by the default methods parseFromInt(ChronoEntity, int) or printToInt(Enum, ChronoDisplay, AttributeQuery). The integer Integer.MIN_VALUE must be avoided in this conversion.

      Parameters:
      value - value to be converted to int
      Returns:
      Integer-representation of given value
    • printToInt

      default int printToInt(V value, ChronoDisplay context, AttributeQuery attributes)

      Translates given element value to a numerical integer.

      Will be called when element values need to be printed as numbers. The default implementation just delegates to numerical(V).

      Parameters:
      value - value to be converted to int
      context - the object to be formatted
      attributes - format attributes
      Returns:
      Integer-representation of given value
      Since:
      3.37/4.32
    • parseFromInt

      default boolean parseFromInt(ChronoEntity<?> entity, int value)

      Converts and stores given integer into the result buffer.

      Will be called when int values need to be interpreted as enums. The default implementation just delegates to numerical(V).

      Parameters:
      entity - mutable result buffer for parsed values
      value - parsed integer
      Returns:
      true if the integer can be interpreted else false
      Since:
      3.37/4.32