Class LocalizedString

  • All Implemented Interfaces:
    Localized, java.io.Serializable, java.lang.Comparable<LocalizedString>

    public class LocalizedString
    extends java.lang.Object
    implements Localized, java.io.Serializable, java.lang.Comparable<LocalizedString>
    A special string container that holds a key, and returns the localized version of that key on toString(). At the time of creation, however, it stores the value of the key in the default locale, and returns that value should the key not be available later. This makes it possible to serialize and send this class to different scopes, where the key may or may not be available when it comes time to use it.

    NOTE: In cases where a LocalizedString object is required, but the value isn't actually localizable, you can use the static createRaw() function.

    See Also:
    Serialized Form
    • Constructor Detail

      • LocalizedString

        public LocalizedString()
        JavaBean compatibility...
      • LocalizedString

        public LocalizedString​(java.lang.String key,
                               java.lang.Object... params)
      • LocalizedString

        public LocalizedString​(java.util.Locale defaultLocale,
                               java.lang.String key,
                               java.lang.Object... params)
    • Method Detail

      • createRaw

        public static LocalizedString createRaw​(java.lang.String stringVal)
        Creates a localized string not based on a key.
      • getKey

        public java.lang.String getKey()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • toString

        public java.lang.String toString​(java.util.Locale locale)
        Specified by:
        toString in interface Localized
      • getDefaultVal

        public java.lang.String getDefaultVal()
      • setDefaultVal

        public void setDefaultVal​(java.lang.String defaultVal)
      • getParams

        public java.lang.Object[] getParams()
      • setParams

        public void setParams​(java.lang.Object[] params)
      • setKey

        public void setKey​(java.lang.String key)