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 ofCLocale
from values configured by the setters.
ACLocale
object 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 CLocale
build()
Returns an instance of locale created from the fields set on this builder.static CLocale
build(String localeIdentifier)
Returns an instance of locale created from the fields set on this builder.static CLocaleBuilder
create(Language language)
Creates a builder by theLanguage
passed as argument.static boolean
isValid(String localeIdentifier)
Returns an instance of locale created from the fields set on this builder.CLocaleBuilder
setRegion(Region region)
Sets the region to use for locale.CLocaleBuilder
setScript(Script script)
Sets the script code of the locale.CLocaleBuilder
setVariantAndExtension(String variantAndExtension)
Sets the variant and extension parts of the locale.
-
-
-
Method Detail
-
create
public static CLocaleBuilder create(Language language)
Creates a builder by theLanguage
passed 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.
-
-