Package org.onosproject.ui.lion
Class LionBundle
- java.lang.Object
-
- org.onosproject.ui.lion.LionBundle
-
public final class LionBundle extends java.lang.ObjectEncapsulates a bundle of localization strings.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLionBundle.BuilderBuilder of Lion Bundles.static classLionBundle.LionItemRepresents a single localization item.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Stringdump()Dump the contents of the bundle.java.util.Set<LionBundle.LionItem>getItems()Returns an immutable set of the items in this bundle.java.lang.StringgetSafe(java.lang.Enum<?> enumConst)Converts the given enum constant to lowercase and then uses that as the key to invokegetSafe(String).java.lang.StringgetSafe(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.StringgetValue(java.lang.String key)Returns the localized value for the given key, or null if no such mapping exists.java.lang.Stringid()Returns the bundle's identifier.intsize()Returns the number of entries in this bundle.java.lang.StringtoString()
-
-
-
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:
toStringin classjava.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 invokegetSafe(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
-
-