Package org.pepstock.charba.client.intl
Class CLocaleBuilder
- java.lang.Object
-
- org.pepstock.charba.client.intl.CLocaleBuilder
-
public final class CLocaleBuilder extends Object
The builder is used to build instances ofCLocalefrom values configured by the setters.
ACLocaleobject created by a builder is well-formed and can be transformed to a well-formed IETF BCP 47 language and it's also cached.- Author:
- Andrea "Stock" Stocchero
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CLocalebuild()Returns an instance of locale created from the fields set on this builder.static CLocalebuild(String localeIdentifier)Returns an instance of locale created from the fields set on this builder.static CLocaleBuildercreate(Language language)Creates a builder by theLanguagepassed as argument.static booleanisValid(String localeIdentifier)Returns an instance of locale created from the fields set on this builder.CLocaleBuildersetRegion(Region region)Sets the region to use for locale.CLocaleBuildersetScript(Script script)Sets the script code of the locale.CLocaleBuildersetVariantAndExtension(String variantAndExtension)Sets the variant and extension parts of the locale.
-
-
-
Method Detail
-
create
public static CLocaleBuilder create(Language language)
Creates a builder by theLanguagepassed as argument.- Parameters:
language- language for locale building- Returns:
- a locale builder instance
-
setScript
public CLocaleBuilder setScript(Script script)
Sets the script code of the locale.- Parameters:
script- the script code of the locale- Returns:
- a locale builder instance
-
setRegion
public CLocaleBuilder setRegion(Region region)
Sets the region to use for locale.- Parameters:
region- the region to use for locale.- Returns:
- a locale builder instance
-
setVariantAndExtension
public CLocaleBuilder setVariantAndExtension(String variantAndExtension)
Sets the variant and extension parts of the locale.- Parameters:
variantAndExtension- the variant and extension parts of the locale- Returns:
- a locale builder instance
-
build
public CLocale build()
Returns an instance of locale created from the fields set on this builder.- Returns:
- a locale instance.
-
build
public static CLocale build(String localeIdentifier)
Returns an instance of locale created from the fields set on this builder.- Parameters:
localeIdentifier- locale identifier to parse to get a locale.- Returns:
- a locale instance.
-
isValid
public static boolean isValid(String localeIdentifier)
Returns an instance of locale created from the fields set on this builder.- Parameters:
localeIdentifier- locale identifier to parse to get a locale.- Returns:
- a locale instance.
-
-