Package org.onosproject.ui.lion
Class LionBundle
- java.lang.Object
-
- org.onosproject.ui.lion.LionBundle
-
public final class LionBundle extends Object
Encapsulates 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 Stringdump()Dump the contents of the bundle.Set<LionBundle.LionItem>getItems()Returns an immutable set of the items in this bundle.StringgetSafe(Enum<?> enumConst)Converts the given enum constant to lowercase and then uses that as the key to invokegetSafe(String).StringgetSafe(String key)Returns the localized value for the given key, or, if no such mapping exists, returns the key wrapped in '%' characters.StringgetValue(String key)Returns the localized value for the given key, or null if no such mapping exists.Stringid()Returns the bundle's identifier.intsize()Returns the number of entries in this bundle.StringtoString()
-
-
-
Method Detail
-
id
public 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
-
getValue
public String getValue(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 String getSafe(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 String getSafe(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 Set<LionBundle.LionItem> getItems()
Returns an immutable set of the items in this bundle.- Returns:
- the items in this bundle
-
dump
public String dump()
Dump the contents of the bundle.- Returns:
- dumped contents
-
-