Implementation Specification
Implementations must be thread-safe. Implementations should cache the textual information.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class | DateTimeTextProvider.
Stores the text for a single locale. |
| Modifier and Type | Field and Description |
|---|---|
| private static final ConcurrentMap | CACHE
Cache. |
| private static final Comparator | COMPARATOR
Comparator. |
| private static final DateTimeTextProvider |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| private static <A, B> Map. | Returns: the entry, not nullthe text, not null text, B the field, not null field)Helper method to create an immutable entry. |
| private Object | |
| private Object | |
| pack-priv static DateTimeTextProvider | |
| pack-priv static <T> T | Returns: the localized resource, or null if not availablethe key of the localized resource, not null key, Locale the locale, not null locale)Returns the localized resource of the given key and locale, or null if no localized resource is available. |
| public String | Returns: the text for the field value, null if no text foundthe field to get text for, not null field, long the field value to get text for, not null value, TextStyle the style to get text for, not null style, Locale the locale to get text for, not null locale)Gets the text for the specified field, locale and style for the purpose of formatting. |
| public String | Returns: the text for the field value, null if no text foundthe Chronology to get text for, not null chrono, TemporalField the field to get text for, not null field, long the field value to get text for, not null value, TextStyle the style to get text for, not null style, Locale the locale to get text for, not null locale)Gets the text for the specified chrono, field, locale and style for the purpose of formatting. |
| public Iterator | Returns: the iterator of text to field pairs, in order from longest text to shortest text, null if the field or style is not parsablethe field to get text for, not null field, TextStyle the style to get text for, null for all parsable text style, Locale the locale to get text for, not null locale)Gets an iterator of text to field for the specified field, locale and style for the purpose of parsing. |
| public Iterator | Returns: the iterator of text to field pairs, in order from longest text to shortest text, null if the field or style is not parsablethe Chronology to get text for, not null chrono, TemporalField the field to get text for, not null field, TextStyle the style to get text for, null for all parsable text style, Locale the locale to get text for, not null locale)Gets an iterator of text to field for the specified chrono, field, locale and style for the purpose of parsing. |
| private static int |
| CACHE | back to summary |
|---|---|
| private static final ConcurrentMap<Map. Cache. | |
| COMPARATOR | back to summary |
|---|---|
| private static final Comparator<Map. Comparator. | |
| INSTANCE | back to summary |
|---|---|
| private static final DateTimeTextProvider INSTANCE | |
| DateTimeTextProvider | back to summary |
|---|---|
| pack-priv DateTimeTextProvider() | |
| createEntry | back to summary |
|---|---|
| private static <A, B> Map. Helper method to create an immutable entry. | |
| createStore | back to summary |
|---|---|
| private Object createStore(TemporalField field, Locale locale) | |
| findStore | back to summary |
|---|---|
| private Object findStore(TemporalField field, Locale locale) | |
| getInstance | back to summary |
|---|---|
| pack-priv static DateTimeTextProvider getInstance() Gets the provider of text.
| |
| getLocalizedResource | back to summary |
|---|---|
| pack-priv static <T> T getLocalizedResource(String key, Locale locale) Returns the localized resource of the given key and locale, or null if no localized resource is available.
| |
| getText | back to summary |
|---|---|
| public String getText(TemporalField field, long value, TextStyle style, Locale locale) Gets the text for the specified field, locale and style for the purpose of formatting. The text associated with the value is returned. The null return value should be used if there is no applicable text, or if the text would be a numeric representation of the value.
| |
| getText | back to summary |
|---|---|
| public String getText(Chronology chrono, TemporalField field, long value, TextStyle style, Locale locale) Gets the text for the specified chrono, field, locale and style for the purpose of formatting. The text associated with the value is returned. The null return value should be used if there is no applicable text, or if the text would be a numeric representation of the value.
| |
| getTextIterator | back to summary |
|---|---|
| public Iterator Gets an iterator of text to field for the specified field, locale and style for the purpose of parsing. The iterator must be returned in order from the longest text to the shortest. The null return value should be used if there is no applicable parsable text, or if the text would be a numeric representation of the value. Text can only be parsed if all the values for that field-style-locale combination are unique.
| |
| getTextIterator | back to summary |
|---|---|
| public Iterator Gets an iterator of text to field for the specified chrono, field, locale and style for the purpose of parsing. The iterator must be returned in order from the longest text to the shortest. The null return value should be used if there is no applicable parsable text, or if the text would be a numeric representation of the value. Text can only be parsed if all the values for that field-style-locale combination are unique.
| |
| toWeekDay | back to summary |
|---|---|
| private static int toWeekDay(int calWeekDay) | |
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.
| Modifier and Type | Field and Description |
|---|---|
| private final Map | parsable
Parsable data. |
| private final Map | valueTextMap
Map of value to text. |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv String | |
| pack-priv Iterator | Returns: the iterator of text to field pairs, in order from longest text to shortest text, null if the style is not parsablethe style to get text for, null for all parsable text style)Gets an iterator of text to field for the specified style for the purpose of parsing. |
| parsable | back to summary |
|---|---|
| private final Map<TextStyle, List<Map. Parsable data. | |
| valueTextMap | back to summary |
|---|---|
| private final Map<TextStyle, Map<Long, String>> valueTextMap Map of value to text. | |
| LocaleStore | back to summary |
|---|---|
| pack-priv LocaleStore(Map<TextStyle, Map<Long, String>> valueTextMap) Constructor. | |
| getText | back to summary |
|---|---|
| pack-priv String getText(long value, TextStyle style) Gets the text for the specified field value, locale and style for the purpose of printing. | |
| getTextIterator | back to summary |
|---|---|
| pack-priv Iterator 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. | |