Package se.litsec.opensaml.core
Class LocalizedString
- java.lang.Object
-
- se.litsec.opensaml.core.LocalizedString
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_LANGUAGE_TAGDefault language tag.
-
Constructor Summary
Constructors Constructor Description LocalizedString(String source)Creates an instance by parsing the source string that must be on the format<lang-tag>-<string according to language>.LocalizedString(String localString, String language)Constructor.LocalizedString(String localString, Locale locale)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)Determines if two LocalizedStrings are equal, that is, if both thier localized string and language have case-sentivite equality.StringgetLanguage()Gets the language of the string.StringgetLocalString()Gets the localized string.inthashCode()voidsetLanguage(String newLanguage)Sets the language of the string.voidsetLocalizedString(String newString)Sets the localized string.StringtoString()
-
-
-
Field Detail
-
DEFAULT_LANGUAGE_TAG
public static final String DEFAULT_LANGUAGE_TAG
Default language tag.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
LocalizedString
public LocalizedString(String source)
Creates an instance by parsing the source string that must be on the format<lang-tag>-<string according to language>. The string "en-Hello" will give a LocalizedString where:ls.getLanguage() => "en" ls.getLocalString() => "Hello"- Parameters:
source- the string to parse
-
LocalizedString
public LocalizedString(String localString, String language)
Constructor.- Parameters:
localString- the localized stringlanguage- the language of the string
-
LocalizedString
public LocalizedString(String localString, Locale locale)
Constructor.- Parameters:
localString- the localized stringlocale- the locale (the language is obtained usingLocale.getLanguage())
-
-
Method Detail
-
getLocalString
public String getLocalString()
Gets the localized string.- Returns:
- the localized string
-
setLocalizedString
public void setLocalizedString(String newString)
Sets the localized string.- Parameters:
newString- the localized string
-
getLanguage
public String getLanguage()
Gets the language of the string.- Returns:
- the language of the string
-
setLanguage
public void setLanguage(String newLanguage)
Sets the language of the string.- Parameters:
newLanguage- the language of the string
-
equals
public boolean equals(Object obj)
Determines if two LocalizedStrings are equal, that is, if both thier localized string and language have case-sentivite equality.
-
-