Package org.bremersee.common.model
Class JavaLocale
- java.lang.Object
-
- org.bremersee.common.model.JavaLocale
-
- All Implemented Interfaces:
Serializable
public class JavaLocale extends Object implements Serializable
Java locale model.- Author:
- Christian Bremer
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JavaLocale.Separator
The enum Separator.
-
Constructor Summary
Constructors Modifier Constructor Description protected
JavaLocale(String value)
Instantiates a new java locale.JavaLocale(String language, String country)
Instantiates a new java locale.JavaLocale(ThreeLetterLanguageCode language, ThreeLetterCountryCode country)
Instantiates a new java locale.JavaLocale(TwoLetterLanguageCode language, TwoLetterCountryCode country)
Instantiates a new java locale.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static JavaLocale
fromLocale(Locale locale)
From locale.static JavaLocale
fromValue(String value)
From value.String
getCountry()
Gets country.String
getLanguage()
Gets language.void
setCountry(String country)
Sets country.void
setLanguage(String language)
Sets language.Locale
toLocale()
To locale.Locale
toLocale(Locale defaultLocale)
To locale.String
toString()
String
toString(JavaLocale.Separator separator)
To string with separator.
-
-
-
Constructor Detail
-
JavaLocale
protected JavaLocale(String value)
Instantiates a new java locale.- Parameters:
value
- the value
-
JavaLocale
public JavaLocale(String language, String country)
Instantiates a new java locale.- Parameters:
language
- the languagecountry
- the country
-
JavaLocale
public JavaLocale(TwoLetterLanguageCode language, TwoLetterCountryCode country)
Instantiates a new java locale.- Parameters:
language
- the languagecountry
- the country
-
JavaLocale
public JavaLocale(ThreeLetterLanguageCode language, ThreeLetterCountryCode country)
Instantiates a new java locale.- Parameters:
language
- the languagecountry
- the country
-
-
Method Detail
-
getLanguage
public String getLanguage()
Gets language.- Returns:
- the language
-
setLanguage
public void setLanguage(String language)
Sets language.- Parameters:
language
- the language
-
getCountry
public String getCountry()
Gets country.- Returns:
- the country
-
setCountry
public void setCountry(String country)
Sets country.- Parameters:
country
- the country
-
toString
public String toString(JavaLocale.Separator separator)
To string with separator.- Parameters:
separator
- the separator- Returns:
- the locale string
-
toLocale
public Locale toLocale()
To locale.- Returns:
- the locale
-
toLocale
public Locale toLocale(Locale defaultLocale)
To locale.- Parameters:
defaultLocale
- the default locale- Returns:
- the locale
-
fromValue
public static JavaLocale fromValue(String value)
From value.- Parameters:
value
- the value- Returns:
- the java locale
-
fromLocale
public static JavaLocale fromLocale(Locale locale)
From locale.- Parameters:
locale
- the locale- Returns:
- the java locale
-
-