|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.portal.common.util.LocalizedString
An immutable localized string.
Nested Class Summary | |
static class |
LocalizedString.Value
A localized value. |
Constructor Summary | |
LocalizedString(java.util.Locale defaultLocale)
|
|
LocalizedString(java.util.Map values,
java.util.Locale defaultLocale)
|
|
LocalizedString(java.lang.String value,
java.util.Locale defaultLocale)
Convenience constructor for simple localized strings with only one value using the default locale. |
Method Summary | |
java.util.Locale |
getDefaultLocale()
Return the default locale of this description. |
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)
Return the string of the localized value of the description. |
LocalizedString.Value |
getValue(java.util.Locale locale,
boolean resolve)
Return a localized value of the description. |
boolean |
hasValues()
Determines if this LocalizedString contains any values. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public LocalizedString(java.lang.String value, java.util.Locale defaultLocale)
value
- the localized value using the specified default localedefaultLocale
- the default localepublic LocalizedString(java.util.Locale defaultLocale)
public LocalizedString(java.util.Map values, java.util.Locale defaultLocale)
Method Detail |
public boolean hasValues()
true
if this LocalizedString contains localized values, false
otherwise.public java.lang.String getString(java.util.Locale locale, boolean resolve)
locale
- the desired locale for the descriptionresolve
- true if the locale must be resolved to the most appropriate
public LocalizedString.Value getValue(java.util.Locale locale, boolean resolve)
locale
- the desired locale for the descriptionresolve
- 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 LocaleInfo.decodeLocaleInfoFromRFC3066LanguageTag(String)
public java.lang.String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |