APIdia Launch Partner
Top Description Inners Fields Constructors Methods
sun.util.locale.provider

public Class LocaleResources

extends Object
Class Inheritance
Imports
java.lang.ref.ReferenceQueue, .SoftReference, java.text.ListFormat, .MessageFormat, .NumberFormat, java.time.format.FormatStyle, java.util.Arrays, .Calendar, .HashMap, .HashSet, .LinkedHashSet, .List, .Locale, .Map, .Objects, .ResourceBundle, .Set, .TimeZone, java.util.concurrent.ConcurrentHashMap, .ConcurrentMap, java.util.regex.Pattern, java.util.stream.Stream, sun.util.resources.LocaleData, .OpenListResourceBundle, .TimeZoneNamesBundle

Central accessor to locale-dependent resources for JRE/CLDR provider adapters.
Authors
Masayoshi Okutsu, Naoto Sato

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private static final String
private final ConcurrentMap<String, LocaleResources.ResourceReference>
private static final String
private static final String
private static final String
private static final String
private final LazyConstant<String>
private static final String
private static final String
private static final String
private static final LazyConstant<Map<String, Map<String, String>>>
private final LazyConstant<String>
private static final String
private final Locale
private static final String
private final LocaleData
private static final Object
private static final String
private final ReferenceQueue<Object>
private static final String
private static final String
private static final String
private static final String
private static final boolean
private final LocaleProviderAdapter.Type
private static final String
private static final String
private static final Pattern
private static final String

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv Object
pack-priv byte[]
public String
pack-priv String[]
public String[]

Returns:

an array of compact number patterns
getCNPatterns
(NumberFormat.Style
the style for formatting a number
formatStyle
)

Returns the compact number format patterns.

public String
public String
public String

Returns:

the pattern string
getDateTimeFormatterPattern
(FormatStyle
style of time; one of FULL, LONG, MEDIUM, SHORT in FormatStyle, or null if not required
dateStyle
,
FormatStyle
style of time; one of FULL, LONG, MEDIUM, SHORT in FormatStyle, or null if not required
timeStyle
,
String
the calendar type for the pattern
calType
)

Returns a date-time format pattern

public String
getDateTimePattern(int timeStyle, int dateStyle, Calendar cal)

private String
getDateTimePattern(String prefix, int timeStyle, int dateStyle, String calType)

private String
getDateTimePattern(String prefix, String key, int styleIndex, String calendarType)

public Object[]
public ResourceBundle
getJavaTimeFormatData()

Returns the FormatData resource bundle of this LocaleResources.

pack-priv String[]
public String[]

Returns:

the list patterns for the locale
getListPatterns
(ListFormat.Type type, ListFormat.Style style)

Returns the list patterns for the locale.

public String
public String

Returns:

format pattern string for this locale, null if not found
getLocalizedPattern
(String
requested template
requestedTemplate
,
String
calendar type
calType
)

Returns the actual format pattern string based on the requested template and calendar type for this locale.

private String
getLocalizedPatternImpl(String requestedTemplate, String calType)

public String[]
private String[]
public String[]
public Object
pack-priv Set<String>
pack-priv String[][]
private String
private static Map<String, Map<String, String>>
private String
matchSkeleton(String skeleton, String calType)

private Stream<String>

Returns:

inferred Stream of skeletons in its priority order
possibleInferred
(String
original skeleton
skeleton
)

Returns a stream of possible skeletons, inferring standalone/format (M/L and/or E/c) patterns and their styles.

private List<String>

Returns:

list of skeletons
priorityList
(String
skeleton
skeleton
,
String
pattern character string
pChar
,
String
substitute character string
subChar
)

Inferring the possible format styles in priority order, based on the original skeleton length.

private void
private String

Returns:

resolved skeletons for this locale, defaults to "h" if none found.
resolveInputSkeleton
(String
type of the input skeleton
type
)

Resolve locale specific input skeletons.

private String

Returns:

skeleton with j/C substituted with concrete patterns
substituteInputSkeletons
(String
requested skeleton
requestedTemplate
)

Replace 'j' and 'C' input skeletons with locale specific patterns.

public static void
trace(String format, Object... params)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

BREAK_ITERATOR_INFOback to summary
private static final String BREAK_ITERATOR_INFO
cacheback to summary
private final ConcurrentMap<String, LocaleResources.ResourceReference> cache
CALENDAR_DATAback to summary
private static final String CALENDAR_DATA
CALENDAR_NAMESback to summary
private static final String CALENDAR_NAMES
COLLATION_DATAback to summary
private static final String COLLATION_DATA
COMPACT_NUMBER_PATTERNS_CACHEKEYback to summary
private static final String COMPACT_NUMBER_PATTERNS_CACHEKEY
CPatternback to summary
private final LazyConstant<String> CPattern
CURRENCY_NAMESback to summary
private static final String CURRENCY_NAMES
DATE_TIME_PATTERNback to summary
private static final String DATE_TIME_PATTERN
DECIMAL_FORMAT_SYMBOLS_DATA_CACHEKEYback to summary
private static final String DECIMAL_FORMAT_SYMBOLS_DATA_CACHEKEY
INPUT_SKELETONSback to summary
private static final LazyConstant<Map<String, Map<String, String>>> INPUT_SKELETONS
jPatternback to summary
private final LazyConstant<String> jPattern
LIST_PATTERNback to summary
private static final String LIST_PATTERN
localeback to summary
private final Locale locale
LOCALE_NAMESback to summary
private static final String LOCALE_NAMES
localeDataback to summary
private final LocaleData localeData
NULLOBJECTback to summary
private static final Object NULLOBJECT
NUMBER_PATTERNS_CACHEKEYback to summary
private static final String NUMBER_PATTERNS_CACHEKEY
referenceQueueback to summary
private final ReferenceQueue<Object> referenceQueue
RULES_CACHEKEYback to summary
private static final String RULES_CACHEKEY
SKELETON_INPUT_REGIONS_KEYback to summary
private static final String SKELETON_INPUT_REGIONS_KEY
SKELETON_PATTERNback to summary
private static final String SKELETON_PATTERN
TIME_ZONE_NAMESback to summary
private static final String TIME_ZONE_NAMES
TRACE_ONback to summary
private static final boolean TRACE_ON
typeback to summary
private final LocaleProviderAdapter.Type type
TZNB_EXCITY_PREFIXback to summary
private static final String TZNB_EXCITY_PREFIX
TZNB_METAZONE_DSTOFFSET_PREFIXback to summary
private static final String TZNB_METAZONE_DSTOFFSET_PREFIX
VALID_SKELETON_PATTERNback to summary
private static final Pattern VALID_SKELETON_PATTERN
ZONE_IDS_CACHEKEYback to summary
private static final String ZONE_IDS_CACHEKEY

Constructor Detail

LocaleResourcesback to summary
pack-priv LocaleResources(ResourceBundleBasedAdapter adapter, Locale locale)

Method Detail

getBreakIteratorInfoback to summary
pack-priv Object getBreakIteratorInfo(String key)
getBreakIteratorResourcesback to summary
pack-priv byte[] getBreakIteratorResources(String key)
getCalendarDataback to summary
public String getCalendarData(String key)
getCalendarNamesback to summary
pack-priv String[] getCalendarNames(String key)
getCNPatternsback to summary
public String[] getCNPatterns(NumberFormat.Style formatStyle)

Returns the compact number format patterns.

Parameters
formatStyle:NumberFormat.Style

the style for formatting a number

Returns:String[]

an array of compact number patterns

getCollationDataback to summary
public String getCollationData()
getCurrencyNameback to summary
public String getCurrencyName(String key)
getDateTimeFormatterPatternback to summary
public String getDateTimeFormatterPattern(FormatStyle dateStyle, FormatStyle timeStyle, String calType)

Returns a date-time format pattern

Parameters
dateStyle:FormatStyle

style of time; one of FULL, LONG, MEDIUM, SHORT in FormatStyle, or null if not required

timeStyle:FormatStyle

style of time; one of FULL, LONG, MEDIUM, SHORT in FormatStyle, or null if not required

calType:String

the calendar type for the pattern

Returns:String

the pattern string

getDateTimePatternback to summary
public String getDateTimePattern(int timeStyle, int dateStyle, Calendar cal)
getDateTimePatternback to summary
private String getDateTimePattern(String prefix, int timeStyle, int dateStyle, String calType)
getDateTimePatternback to summary
private String getDateTimePattern(String prefix, String key, int styleIndex, String calendarType)
getDecimalFormatSymbolsDataback to summary
public Object[] getDecimalFormatSymbolsData()
getJavaTimeFormatDataback to summary
public ResourceBundle getJavaTimeFormatData()

Returns the FormatData resource bundle of this LocaleResources. The FormatData should be used only for accessing extra resources required by JSR 310.

getJavaTimeNamesback to summary
pack-priv String[] getJavaTimeNames(String key)
getListPatternsback to summary
public String[] getListPatterns(ListFormat.Type type, ListFormat.Style style)

Returns the list patterns for the locale.

Parameters
type:ListFormat.Type

a ListFormat.Type

style:ListFormat.Style

a ListFormat.Style

Returns:String[]

the list patterns for the locale

getLocaleNameback to summary
public String getLocaleName(String key)
getLocalizedPatternback to summary
public String getLocalizedPattern(String requestedTemplate, String calType)

Returns the actual format pattern string based on the requested template and calendar type for this locale.

Parameters
requestedTemplate:String

requested template

calType:String

calendar type

Returns:String

format pattern string for this locale, null if not found

Exceptions
IllegalArgumentException:
if the requested template is invalid
getLocalizedPatternImplback to summary
private String getLocalizedPatternImpl(String requestedTemplate, String calType)
getNumberPatternsback to summary
public String[] getNumberPatterns()
getNumberStringsback to summary
private String[] getNumberStrings(ResourceBundle rb, String type)
getRulesback to summary
public String[] getRules()
getTimeZoneNamesback to summary
public Object getTimeZoneNames(String key)
getZoneIDsback to summary
pack-priv Set<String> getZoneIDs()
Annotations
@SuppressWarnings:unchecked
getZoneStringsback to summary
pack-priv String[][] getZoneStrings()
initCPatternback to summary
private String initCPattern()
initSkeletonsback to summary
private static Map<String, Map<String, String>> initSkeletons()
matchSkeletonback to summary
private String matchSkeleton(String skeleton, String calType)
possibleInferredback to summary
private Stream<String> possibleInferred(String skeleton)

Returns a stream of possible skeletons, inferring standalone/format (M/L and/or E/c) patterns and their styles. (cf. 2.6.2.1 Matching Skeletons)

Parameters
skeleton:String

original skeleton

Returns:Stream<String>

inferred Stream of skeletons in its priority order

priorityListback to summary
private List<String> priorityList(String skeleton, String pChar, String subChar)

Inferring the possible format styles in priority order, based on the original skeleton length.

Parameters
skeleton:String

skeleton

pChar:String

pattern character string

subChar:String

substitute character string

Returns:List<String>

list of skeletons

removeEmptyReferencesback to summary
private void removeEmptyReferences()
resolveInputSkeletonback to summary
private String resolveInputSkeleton(String type)

Resolve locale specific input skeletons. Fall back method is different from usual resource bundle's, as it has to be "lang-region" -> "region" -> "lang-001" -> "001"

Parameters
type:String

type of the input skeleton

Returns:String

resolved skeletons for this locale, defaults to "h" if none found.

substituteInputSkeletonsback to summary
private String substituteInputSkeletons(String requestedTemplate)

Replace 'j' and 'C' input skeletons with locale specific patterns. Note that 'j' is guaranteed to be replaced with one char [hkHK], while 'C' may be replaced with multiple chars. Repeat each as much as 'C' count.

Parameters
requestedTemplate:String

requested skeleton

Returns:String

skeleton with j/C substituted with concrete patterns

traceback to summary
public static void trace(String format, Object... params)
sun.util.locale.provider back to summary

private Class LocaleResources.ResourceReference

extends SoftReference<Object>
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final String

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv String
Inherited from java.lang.ref.SoftReference:
get

Field Detail

cacheKeyback to summary
private final String cacheKey

Constructor Detail

ResourceReferenceback to summary
pack-priv ResourceReference(String cacheKey, Object o, ReferenceQueue<Object> q)

Method Detail

getCacheKeyback to summary
pack-priv String getCacheKey()