Class LocalizedString
java.lang.Object
se.swedenconnect.opensaml.common.utils.LocalizedString
Utility class for a localized string.
- Author:
- Martin Lindström (martin@idsec.se)
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorDescriptionDefault constructor.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
Modifier and TypeMethodDescriptionboolean
Determines if two LocalizedStrings are equal, that is, if both thier localized string and language have case-sentivite equality.Gets the language of the string.Gets the localized string.int
hashCode()
void
setLanguage
(String newLanguage) Sets the language of the string.void
setLocalizedString
(String newString) Sets the localized string.toString()
-
Field Details
-
DEFAULT_LANGUAGE_TAG
Default language tag.- See Also:
-
-
Constructor Details
-
LocalizedString
public LocalizedString()Default constructor. -
LocalizedString
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
Constructor.- Parameters:
localString
- the localized stringlanguage
- the language of the string
-
LocalizedString
Constructor.- Parameters:
localString
- the localized stringlocale
- the locale (the language is obtained usingLocale.getLanguage()
)
-
-
Method Details
-
getLocalString
Gets the localized string.- Returns:
- the localized string
-
setLocalizedString
Sets the localized string.- Parameters:
newString
- the localized string
-
getLanguage
Gets the language of the string.- Returns:
- the language of the string
-
setLanguage
Sets the language of the string.- Parameters:
newLanguage
- the language of the string
-
hashCode
public int hashCode() -
equals
Determines if two LocalizedStrings are equal, that is, if both thier localized string and language have case-sentivite equality. -
toString
-