Class LionBundle


  • public final class LionBundle
    extends java.lang.Object
    Encapsulates a bundle of localization strings.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  LionBundle.Builder
      Builder of Lion Bundles.
      static class  LionBundle.LionItem
      Represents a single localization item.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String dump()
      Dump the contents of the bundle.
      java.util.Set<LionBundle.LionItem> getItems()
      Returns an immutable set of the items in this bundle.
      java.lang.String getSafe​(java.lang.Enum<?> enumConst)
      Converts the given enum constant to lowercase and then uses that as the key to invoke getSafe(String).
      java.lang.String getSafe​(java.lang.String key)
      Returns the localized value for the given key, or, if no such mapping exists, returns the key wrapped in '%' characters.
      java.lang.String getValue​(java.lang.String key)
      Returns the localized value for the given key, or null if no such mapping exists.
      java.lang.String id()
      Returns the bundle's identifier.
      int size()
      Returns the number of entries in this bundle.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Method Detail

      • id

        public java.lang.String id()
        Returns the bundle's identifier.
        Returns:
        the bundle's ID
      • size

        public int size()
        Returns the number of entries in this bundle.
        Returns:
        number of entries
      • toString

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

        public java.lang.String getValue​(java.lang.String key)
        Returns the localized value for the given key, or null if no such mapping exists.
        Parameters:
        key - the key
        Returns:
        the localized value
      • getSafe

        public java.lang.String getSafe​(java.lang.String key)
        Returns the localized value for the given key, or, if no such mapping exists, returns the key wrapped in '%' characters.
        Parameters:
        key - the key
        Returns:
        the localized value (or a wrapped key placeholder)
      • getSafe

        public java.lang.String getSafe​(java.lang.Enum<?> enumConst)
        Converts the given enum constant to lowercase and then uses that as the key to invoke getSafe(String).
        Parameters:
        enumConst - the constant to use as the key
        Returns:
        the localized value (or a wrapped key placeholder)
      • getItems

        public java.util.Set<LionBundle.LionItem> getItems()
        Returns an immutable set of the items in this bundle.
        Returns:
        the items in this bundle
      • dump

        public java.lang.String dump()
        Dump the contents of the bundle.
        Returns:
        dumped contents