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 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 String
dump()
Dump the contents of the bundle.Set<LionBundle.LionItem>
getItems()
Returns an immutable set of the items in this bundle.String
getSafe(Enum<?> enumConst)
Converts the given enum constant to lowercase and then uses that as the key to invokegetSafe(String)
.String
getSafe(String key)
Returns the localized value for the given key, or, if no such mapping exists, returns the key wrapped in '%' characters.String
getValue(String key)
Returns the localized value for the given key, or null if no such mapping exists.String
id()
Returns the bundle's identifier.int
size()
Returns the number of entries in this bundle.String
toString()
-
-
-
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
-
-