|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.portal.common.i18n.LocalizedString
public final class LocalizedString
An immutable locale sensitive object that returns strings.
Nested Class Summary | |
---|---|
static class |
LocalizedString.Value
A localized string value. |
Constructor Summary | |
---|---|
LocalizedString(java.util.Locale defaultLocale)
Build an empty localized string. |
|
LocalizedString(java.util.Map values,
java.util.Locale defaultLocale)
Build a localized string using a |
|
LocalizedString(java.lang.String defaultValue)
Convenience constructor for simple localized strings with only one value using the Locale.ENGLISH locale. |
|
LocalizedString(java.lang.String defaultValue,
java.util.Locale defaultLocale)
Convenience constructor for simple localized strings with only one value using the default locale. |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object o)
|
java.util.Locale |
getDefaultLocale()
Return the default locale of this localized string. |
java.lang.String |
getDefaultString()
Return the string for the default locale. |
LocalizedString.Value |
getDefaultValue()
Returns the value for the default locale. |
java.lang.String |
getMostAppropriateValueFor(java.lang.String[] desiredLocales)
Retrieves the localized value most appropriate based on the given desired locales. |
LocalizedString.Value |
getPreferredOrBestLocalizedMappingFor(java.lang.String[] desiredLocales)
Retrieves the Locale-String mapping most appropriate based on the given desired locales, which are ordered according to locale preferences. |
java.lang.String |
getString(java.util.Locale locale,
boolean resolve)
Returns a string value. |
LocalizedString.Value |
getValue(java.util.Locale locale,
boolean resolve)
Returns a localized value. |
int |
hashCode()
|
boolean |
hasValues()
Determines if this LocalizedString contains any values. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public LocalizedString(java.lang.String defaultValue) throws java.lang.IllegalArgumentException
Locale.ENGLISH
locale.
defaultValue
- the localized value using the specified default locale
java.lang.IllegalArgumentException
- if no default value or locale is providedpublic LocalizedString(java.lang.String defaultValue, java.util.Locale defaultLocale) throws java.lang.IllegalArgumentException
defaultValue
- the localized value using the specified default localedefaultLocale
- the default locale
java.lang.IllegalArgumentException
- if no default value or locale is providedpublic LocalizedString(java.util.Locale defaultLocale) throws java.lang.IllegalArgumentException
defaultLocale
- the default locale
java.lang.IllegalArgumentException
- if no default locale is providedpublic LocalizedString(java.util.Map values, java.util.Locale defaultLocale) throws java.lang.IllegalArgumentException
values
- the defaultLocale
-
java.lang.IllegalArgumentException
- if one argument if null or if the map entries are different from Method Detail |
---|
public boolean hasValues()
true
if this LocalizedString contains localized values, false
otherwise.public java.lang.String getDefaultString()
public LocalizedString.Value getDefaultValue()
public java.lang.String getString(java.util.Locale locale, boolean resolve)
locale
- the desired localeresolve
- true if the locale must be resolved to the most appropriate
public LocalizedString.Value getValue(java.util.Locale locale, boolean resolve)
locale
- the desired localeresolve
- true if the locale must be resolved to the most appropriate
public java.util.Locale getDefaultLocale()
public java.lang.String getMostAppropriateValueFor(java.lang.String[] desiredLocales) throws java.lang.IllegalArgumentException
desiredLocales
- an array of compound language tags (as defined by IETF
RFC 3066) ordered according to locale preferences.
java.lang.IllegalArgumentException
- if the array is null or one of the array string is null or invalid (see
#getLocaleFromRFC3066LanguageTag(String))public LocalizedString.Value getPreferredOrBestLocalizedMappingFor(java.lang.String[] desiredLocales) throws java.lang.IllegalArgumentException
desiredLocales
- an array of compound language tags (as defined by IETF
RFC 3066) ordered according to locale preferences.
java.lang.IllegalArgumentException
- if the array is null or one of the array string is null or invalid (see LocaleFormat#RFC3066_LANGUAGE_TAG#getLocale(String)
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |