Class SimpleDateTimeTextProvider.LocaleStore

  • Enclosing class:
    SimpleDateTimeTextProvider

    static final class SimpleDateTimeTextProvider.LocaleStore
    extends java.lang.Object
    Stores the text for a single locale.

    Some fields have a textual representation, such as day-of-week or month-of-year. These textual representations can be captured in this class for printing and parsing.

    This class is immutable and thread-safe.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Map<TextStyle,​java.util.List<java.util.Map.Entry<java.lang.String,​java.lang.Long>>> parsable
      Parsable data.
      private java.util.Map<TextStyle,​java.util.Map<java.lang.Long,​java.lang.String>> valueTextMap
      Map of value to text.
    • Constructor Summary

      Constructors 
      Constructor Description
      LocaleStore​(java.util.Map<TextStyle,​java.util.Map<java.lang.Long,​java.lang.String>> valueTextMap)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) java.lang.String getText​(long value, TextStyle style)
      Gets the text for the specified field value, locale and style for the purpose of printing.
      (package private) java.util.Iterator<java.util.Map.Entry<java.lang.String,​java.lang.Long>> getTextIterator​(TextStyle style)
      Gets an iterator of text to field for the specified style for the purpose of parsing.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • valueTextMap

        private final java.util.Map<TextStyle,​java.util.Map<java.lang.Long,​java.lang.String>> valueTextMap
        Map of value to text.
      • parsable

        private final java.util.Map<TextStyle,​java.util.List<java.util.Map.Entry<java.lang.String,​java.lang.Long>>> parsable
        Parsable data.
    • Constructor Detail

      • LocaleStore

        LocaleStore​(java.util.Map<TextStyle,​java.util.Map<java.lang.Long,​java.lang.String>> valueTextMap)
        Constructor.
        Parameters:
        valueTextMap - the map of values to text to store, assigned and not altered, not null
    • Method Detail

      • getText

        java.lang.String getText​(long value,
                                 TextStyle style)
        Gets the text for the specified field value, locale and style for the purpose of printing.
        Parameters:
        value - the value to get text for, not null
        style - the style to get text for, not null
        Returns:
        the text for the field value, null if no text found
      • getTextIterator

        java.util.Iterator<java.util.Map.Entry<java.lang.String,​java.lang.Long>> getTextIterator​(TextStyle style)
        Gets an iterator of text to field for the specified style for the purpose of parsing.

        The iterator must be returned in order from the longest text to the shortest.

        Parameters:
        style - the style to get text for, null for all parsable text
        Returns:
        the iterator of text to field pairs, in order from longest text to shortest text, null if the style is not parsable