Class TextAccessor

java.lang.Object
net.time4j.format.TextAccessor

public final class TextAccessor extends Object

Supplies an access to the internal name list of an enum-based element value.

Since:
2.0
Author:
Meno Hochschild
See Also:
CalendarText
  • Method Details

    • print

      public String print(Enum<?> value)

      Prints the given element value as String.

      If the element value has no localized representation then this method will simply print the enum name.

      Parameters:
      value - current value of element
      Returns:
      localized text form
    • parse

      public <V extends Enum<V>> V parse(CharSequence parseable, ParsePosition status, Class<V> valueType)

      Interpretes given text form as enum-based element value.

      Parsing is case-insensitive. No partial compare is performed, instead the whole element text will be evaluated.

      Type Parameters:
      V - generic value type of element
      Parameters:
      parseable - text to be parsed
      status - current parsing position
      valueType - value class of element
      Returns:
      element value (as enum) or null if not found
      See Also:
      parse(CharSequence, ParsePosition, Class, AttributeQuery)
    • parse

      public <V extends Enum<V>> V parse(CharSequence parseable, ParsePosition status, Class<V> valueType, Leniency leniency)

      Interpretes given text form as enum-based element value.

      Type Parameters:
      V - generic value type of element
      Parameters:
      parseable - text to be parsed
      status - current parsing position
      valueType - value class of element
      leniency - leniency mode
      Returns:
      element value (as enum) or null if not found
      Since:
      3.15/4.12
      See Also:
      Attributes.LENIENCY, parse(CharSequence, ParsePosition, Class, AttributeQuery)
    • parse

      public <V extends Enum<V>> V parse(CharSequence parseable, ParsePosition status, Class<V> valueType, AttributeQuery attributes)

      Interpretes given text form as enum-based element value.

      The attributes Attributes.PARSE_CASE_INSENSITIVE and Attributes.PARSE_PARTIAL_COMPARE will be evaluated.

      Type Parameters:
      V - generic value type of element
      Parameters:
      parseable - text to be parsed
      status - current parsing position
      valueType - value class of element
      attributes - format attributes
      Returns:
      element value (as enum) or null if not found
      See Also:
      Attributes.PARSE_CASE_INSENSITIVE, Attributes.PARSE_PARTIAL_COMPARE
    • getTextForms

      public List<String> getTextForms()

      Obtains a list of all underlying text forms.

      Returns:
      unmodifiable list of text resources
      Since:
      3.32/4.27
    • toString

      public String toString()

      Supports mainly debugging.

      Overrides:
      toString in class Object