Class LocaleString

java.lang.Object
com.appiancorp.suiteapi.common.LocaleString
All Implemented Interfaces:
Serializable, Cloneable

public final class LocaleString extends Object implements Serializable, Cloneable
LocaleString LocaleString represents one String with representations in one or more Locales, or in all Locales (an insensitive String). This may be output or input as a single encoded String, using escapes.
See Also:
  • Constructor Details

    • LocaleString

      public LocaleString()
    • LocaleString

      public LocaleString(Locale locale, String text)
    • LocaleString

      public LocaleString(String overall)
  • Method Details

    • get

      public final String get(Locale locale)
    • get

      public final String get(String locale)
    • retrieveValueForUserLocaleOrPrimary

      @Deprecated public final String retrieveValueForUserLocaleOrPrimary(Locale userLocale, SiteLocaleSettings sls)
      Deprecated.
      This method will be removed in a future release. Use retrieveValueForUserLocaleOrPrimary(Locale, Locale) instead.
      Returns the localized value for the user's locale, if available. If the value is not available in the user's locale, it falls back to the site's primary locale.
    • retrieveValueForUserLocaleOrPrimary

      public final String retrieveValueForUserLocaleOrPrimary(Locale userLocale, Locale primaryLocale)
      Returns the localized value for the user's locale, if available. If the value is not available in the user's locale, it falls back to the site's primary locale.
    • retrieveValueForLocaleOrFirstAvailable

      public final String retrieveValueForLocaleOrFirstAvailable(Locale targetLocale)
      Returns the localized value for the given locale, if available. If the value is not available in the given locale, returns the first available value. If there are no values at all, returns null.
    • put

      public final void put(String text)
    • put

      public final void put(Locale locale, String text)
    • put

      public final void put(String locale, String text)
    • toEncodedString

      public final String toEncodedString()
      Returns:
      the encoded representation of the mappings contained in this object.
    • getLocales

      public Set<Locale> getLocales()
      Get the Locale keys for this LocaleString.
      Returns:
      Set of Locales stored in this LocaleString, which may be empty for LocaleStrings insensitive to Locale
      Throws:
      IllegalStateException - if an invalid Locale is encountered
    • toString

      public String toString()
      Returns a string representation of the given LocaleString object. The returned string representation is suitable for logging or debugging. This should NOT be used for outputting the string to the end-user.
      Overrides:
      toString in class Object
    • isExpression

      public boolean isExpression()
      Returns:
      if this LocaleString contains an expression as part of its locale mappings.
    • getLocalizeExpressionString

      public String getLocalizeExpressionString()
      Returns:
      the String representation of the localize expression-function used to validate LocaleString objects that contain expressions in its mappings.
    • getStringLocales

      public Set<String> getStringLocales()
    • containsLocale

      public boolean containsLocale(Locale locale_)
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • clone

      public LocaleString clone()
      Clone this LocaleString; the result will have its own locale sensitive map.
      Overrides:
      clone in class Object