|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jboss.portal.common.util.LocalizedString
An immutable localized string.
| Nested Class Summary | |
static class |
LocalizedString.Value
A localized value. |
| Field Summary | |
private java.util.Locale |
defaultLocale
The default locale. |
private static org.jboss.logging.Logger |
log
The logger. |
private java.util.Map |
values
The descriptions. |
| Constructor Summary | |
LocalizedString(java.util.Locale defaultLocale)
|
|
LocalizedString(java.util.Map values,
java.util.Locale defaultLocale)
|
|
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 | |
private void |
addValueForLocale(java.util.Map values,
java.util.Locale locale,
java.lang.String value)
Adds a new value for the specified locale to this LocalizedString. |
java.util.Locale |
getDefaultLocale()
Return the default locale of this description. |
java.lang.String |
getDefaultString()
Return the string for the default locale. |
LocalizedString.Value |
getDefaultValue()
Return 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)
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 |
| Field Detail |
private static final org.jboss.logging.Logger log
private final java.util.Map values
private final java.util.Locale defaultLocale
| Constructor Detail |
public 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
public LocalizedString(java.util.Locale defaultLocale)
throws java.lang.IllegalArgumentException
public LocalizedString(java.util.Map values,
java.util.Locale defaultLocale)
throws java.lang.IllegalArgumentException
| Method Detail |
private void addValueForLocale(java.util.Map values,
java.util.Locale locale,
java.lang.String value)
locale - the locale of the valuevalue - the valuepublic 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 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 | |||||||||