public final class CLocaleBuilder extends Object
CLocale
from values configured by the setters.CLocale
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.Modifier and Type | Method and 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 the
Language 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.
|
public static CLocaleBuilder create(Language language)
Language
passed as argument.language
- language for locale buildingpublic CLocaleBuilder setScript(Script script)
script
- the script code of the localepublic CLocaleBuilder setRegion(Region region)
region
- the region to use for locale.public CLocaleBuilder setVariantAndExtension(String variantAndExtension)
variantAndExtension
- the variant and extension parts of the localepublic CLocale build()
public static CLocale build(String localeIdentifier)
localeIdentifier
- locale identifier to parse to get a locale.public static boolean isValid(String localeIdentifier)
localeIdentifier
- locale identifier to parse to get a locale.