站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBOSS Portal 2.4 API 英文版文档

LocalizedString - JBOSS Portal 2.4 API 英文版文档


org.jboss.portal.common.util
Class LocalizedString

java.lang.Object
  extended byorg.jboss.portal.common.util.LocalizedString

public class LocalizedString
extends java.lang.Object

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

LocalizedString

public LocalizedString(java.lang.String value,
                       java.util.Locale defaultLocale)
Convenience constructor for simple localized strings with only one value using the default locale.

Parameters:
value - the localized value using the specified default locale
defaultLocale - the default locale
Since:
2.4

LocalizedString

public LocalizedString(java.util.Locale defaultLocale)

LocalizedString

public LocalizedString(java.util.Map values,
                       java.util.Locale defaultLocale)
Method Detail

hasValues

public boolean hasValues()
Determines if this LocalizedString contains any values.

Returns:
true if this LocalizedString contains localized values, false otherwise.
Since:
2.4

getString

public java.lang.String getString(java.util.Locale locale,
                                  boolean resolve)
Return the string of the localized value of the description.

Parameters:
locale - the desired locale for the description
resolve - true if the locale must be resolved to the most appropriate
Returns:
the description string or null if it is not found when resolving is false

getValue

public LocalizedString.Value getValue(java.util.Locale locale,
                                      boolean resolve)
Return a localized value of the description.

Parameters:
locale - the desired locale for the description
resolve - true if the locale must be resolved to the most appropriate
Returns:
the description value or null if it is not found when resolving is false

getDefaultLocale

public java.util.Locale getDefaultLocale()
Return the default locale of this description.


getMostAppropriateValueFor

public java.lang.String getMostAppropriateValueFor(java.lang.String[] desiredLocales)
                                            throws java.lang.IllegalArgumentException
Retrieves the localized value most appropriate based on the given desired locales.

Parameters:
desiredLocales - an array of compound language tags (as defined by IETF RFC 3066) ordered according to locale preferences.
Returns:
the most appropriate localized value based on locale preferences.
Throws:
java.lang.IllegalArgumentException - if the array is null or one of the array string is null or invalid (see #getLocaleFromRFC3066LanguageTag(String))
Since:
2.4

getPreferredOrBestLocalizedMappingFor

public LocalizedString.Value getPreferredOrBestLocalizedMappingFor(java.lang.String[] desiredLocales)
                                                            throws java.lang.IllegalArgumentException
Retrieves the Locale-String mapping most appropriate based on the given desired locales, which are ordered according to locale preferences.

Parameters:
desiredLocales - an array of compound language tags (as defined by IETF RFC 3066) ordered according to locale preferences.
Returns:
a Map.Entry representing the most appropriate mapping between Locale and localized value, based on locale preferences.
Throws:
java.lang.IllegalArgumentException - if the array is null or one of the array string is null or invalid (see LocaleInfo.decodeLocaleInfoFromRFC3066LanguageTag(String)
Since:
2.4

toString

public java.lang.String toString()