|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.pivot.util.Resources
public class Resources
Represents a set of localizable resources.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.apache.pivot.collections.Dictionary |
---|
Dictionary.Pair<K,V> |
Constructor Summary | |
---|---|
Resources(Resources parent,
String baseName)
|
|
Resources(Resources parent,
String baseName,
Charset charset)
|
|
Resources(Resources parent,
String baseName,
Locale locale)
|
|
Resources(Resources parent,
String baseName,
Locale locale,
Charset charset)
Creates a new resource bundle. |
|
Resources(Resources parent,
String baseName,
Locale locale,
String charsetName)
|
|
Resources(Resources parent,
String baseName,
String charsetName)
|
|
Resources(String baseName)
|
|
Resources(String baseName,
Charset charset)
|
|
Resources(String baseName,
Locale locale)
|
|
Resources(String baseName,
Locale locale,
String charsetName)
|
|
Resources(String baseName,
String charsetName)
|
Method Summary | |
---|---|
boolean |
containsKey(String key)
Tests the existence of a key in the dictionary. |
Object |
get(String key)
Retrieves the value for the given key. |
String |
getBaseName()
|
Boolean |
getBoolean(String key)
|
Charset |
getCharset()
|
Double |
getDouble(String key)
|
Float |
getFloat(String key)
|
Integer |
getInteger(String key)
|
List<?> |
getList(String key)
|
Locale |
getLocale()
|
Long |
getLong(String key)
|
Map<String,?> |
getMap(String key)
|
Number |
getNumber(String key)
|
Resources |
getParent()
|
Short |
getShort(String key)
|
String |
getString(String key)
|
String |
getString(String key,
String... args)
Gets a resource string with positional token substitution. |
Iterator<String> |
iterator()
|
Object |
put(String key,
Object value)
Sets the value of the given key, creating a new entry or replacing the existing value. |
Object |
remove(String key)
Removes a key/value pair from the map. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Resources(String baseName) throws IOException, SerializationException
IOException
SerializationException
public Resources(Resources parent, String baseName) throws IOException, SerializationException
IOException
SerializationException
public Resources(String baseName, Locale locale) throws IOException, SerializationException
IOException
SerializationException
public Resources(Resources parent, String baseName, Locale locale) throws IOException, SerializationException
IOException
SerializationException
public Resources(String baseName, String charsetName) throws IOException, SerializationException
IOException
SerializationException
public Resources(Resources parent, String baseName, String charsetName) throws IOException, SerializationException
IOException
SerializationException
public Resources(String baseName, Charset charset) throws IOException, SerializationException
IOException
SerializationException
public Resources(Resources parent, String baseName, Charset charset) throws IOException, SerializationException
IOException
SerializationException
public Resources(String baseName, Locale locale, String charsetName) throws IOException, SerializationException
IOException
SerializationException
public Resources(Resources parent, String baseName, Locale locale, String charsetName) throws IOException, SerializationException
IOException
SerializationException
public Resources(Resources parent, String baseName, Locale locale, Charset charset) throws IOException, SerializationException
parent
- The parent resource defer to if a resource cannot be found in this
instance or null.baseName
- The base name of this resource as a fully qualified class name.locale
- The locale to use when reading this resource.charset
- The character encoding to use when reading this resource.
IOException
- If there is a problem when reading the resource.
SerializationException
- If there is a problem deserializing the resource from its JSON format.
IllegalArgumentException
- If baseName or locale or charset is null.
MissingResourceException
- If no resource for the specified base name can be found.Method Detail |
---|
public Resources getParent()
public String getBaseName()
public Locale getLocale()
public Charset getCharset()
public Object get(String key)
Dictionary
get
in interface Dictionary<String,Object>
key
- The key whose value is to be returned.
public String getString(String key)
public String getString(String key, String... args)
For example, if resource string foo were defined to be "{0} knows {1}, and {1} knows {0}.", then calling getString("foo", "Jane", "John") would yield the string "Jane knows John, and John knows Jane."
key
- The resource keyargs
- Arguments referenced within the value of the resource string
public Number getNumber(String key)
public Short getShort(String key)
public Integer getInteger(String key)
public Long getLong(String key)
public Float getFloat(String key)
public Double getDouble(String key)
public Boolean getBoolean(String key)
public List<?> getList(String key)
public Map<String,?> getMap(String key)
public Object put(String key, Object value)
Dictionary
put
in interface Dictionary<String,Object>
key
- The key whose value is to be set.value
- The value to be associated with the given key.
public Object remove(String key)
Dictionary
remove
in interface Dictionary<String,Object>
key
- The key whose mapping is to be removed.
public boolean containsKey(String key)
Dictionary
containsKey
in interface Dictionary<String,Object>
key
- The key whose presence in the dictionary is to be tested.
public Iterator<String> iterator()
iterator
in interface Iterable<String>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |