Package com.google.gwt.i18n.server
Class GwtLocaleFactoryImpl
java.lang.Object
com.google.gwt.i18n.server.GwtLocaleFactoryImpl
- All Implemented Interfaces:
GwtLocaleFactory
Creates server-side GwtLocale instances. Thread-safe.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clear an embedded cache of instances when they are no longer needed.fromComponents
(String language, String script, String region, String variant) Construct a GWT locale from its component parts.fromString
(String localeName) Get a GWT locale from a string conforming to a subset of BCP47 (specifically assuming extension tags are not present, at most one variant is present, and grandfathered tags are not supported; also private-use tags are only supported for the entire tag).Returns an instance of the default locale.
-
Constructor Details
-
GwtLocaleFactoryImpl
public GwtLocaleFactoryImpl()
-
-
Method Details
-
clear
public void clear()Clear an embedded cache of instances when they are no longer needed.Note that GwtLocale instances constructed after this is called will not maintain identity with instances constructed before this call.
-
fromComponents
Description copied from interface:GwtLocaleFactory
Construct a GWT locale from its component parts. Null or empty strings are accepted for parts not present.- Specified by:
fromComponents
in interfaceGwtLocaleFactory
- Parameters:
language
-script
-region
-variant
-- Returns:
- GwtLocale instance, unique for a given set of values
-
fromString
Description copied from interface:GwtLocaleFactory
Get a GWT locale from a string conforming to a subset of BCP47 (specifically assuming extension tags are not present, at most one variant is present, and grandfathered tags are not supported; also private-use tags are only supported for the entire tag). Only minimal validation of BCP47 tags is performed, and will continue with what it is able to parse if unexpected input is encountered. A null or empty string is treated as the default locale.- Specified by:
fromString
in interfaceGwtLocaleFactory
- Parameters:
localeName
-- Returns:
- a locale instance, always the same one for a given localeName
- Throws:
IllegalArgumentException
- if the supplied locale does not match BCP47 structural requirements.
-
getDefault
Description copied from interface:GwtLocaleFactory
Returns an instance of the default locale.- Specified by:
getDefault
in interfaceGwtLocaleFactory
-