Class DateTimeFieldRule.TextStore
java.lang.Object
javax.time.calendar.DateTimeFieldRule.TextStore
- Enclosing class:
DateTimeFieldRule<T>
The mapping between integer values and textual representations.
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.
TextStore is immutable and thread-safe.
-
Field Summary
FieldsModifier and TypeFieldDescriptionMap of case insensitive text to value.private final int[]The lengths of the text items.private final LocaleThe locale of the text.Map of case sensitive text to value.Map of value to text. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the locale that the text relates to.Gets the derived map expressing the value for each text.getValueText(int value) Gets the text for the specified integer value.Gets the map of text for each integer value.longMatches the specified text against the text-value map returning the matched length and value.
-
Field Details
-
locale
The locale of the text. -
valueTextMap
-
textValueMap
-
insensitiveTextValueMap
-
lengths
private final int[] lengthsThe lengths of the text items.
-
-
Constructor Details
-
TextStore
-
-
Method Details
-
getLocale
Gets the locale that the text relates to.- Returns:
- the locale for the text, never null
-
getValueTextMap
-
getValueText
Gets the text for the specified integer value.The text associated with the value is returned, or null if none found.
- Parameters:
value- the value to get text for- Returns:
- the text for the field value, null if no text found
-
getTextValueMap
-
matchText
Matches the specified text against the text-value map returning the matched length and value.This method is intended for use during parsing, and matches the search text against the text-value map, optionally ignoring case.
- Parameters:
ignoreCase- true to ignore case during the matchingparseText- the text to match against- Returns:
- a long packed result of two int values (for performance in parsing).
The value is
(parseLength invalid input: '<'invalid input: '<' 32 + matchedValue). Zero is returned if there is no match. Minus one is returned if the text store cannot parse. The parse length can be obtained via (result >>> 32). The value can be obtained via ((int) result).
-