public static final class DateTimeFieldRule.TextStore extends Object
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.
Constructor and Description |
---|
TextStore(Locale locale,
Map<Integer,String> valueTextMap)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
Locale |
getLocale()
Gets the locale that the text relates to.
|
Map<String,Integer> |
getTextValueMap()
Gets the derived map expressing the value for each text.
|
String |
getValueText(int value)
Gets the text for the specified integer value.
|
Map<Integer,String> |
getValueTextMap()
Gets the map of text for each integer value.
|
long |
matchText(boolean ignoreCase,
String parseText)
Matches the specified text against the text-value map returning the
matched length and value.
|
public Locale getLocale()
public Map<Integer,String> getValueTextMap()
public String getValueText(int value)
The text associated with the value is returned, or null if none found.
value
- the value to get text forpublic Map<String,Integer> getTextValueMap()
If the value-text map contains duplicate text elements then this map will be empty.
public long matchText(boolean ignoreCase, String parseText)
This method is intended for use during parsing, and matches the search text against the text-value map, optionally ignoring case.
ignoreCase
- true to ignore case during the matchingparseText
- the text to match against(parseLength << 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).Copyright © 2014. All rights reserved.