|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.resources.impl.ResourcesBase org.apache.commons.resources.impl.ResourceBundleResources
public class ResourceBundleResources
Concrete implementation of
Resources
that wraps a set
(one per Locale) of java.util.ResourceBundle
instances
that share a common base name.
Constructor Summary | |
---|---|
ResourceBundleResources(String name,
String base)
Create a new Resources
instance with the specified
logical name and bundle base name. |
Method Summary | |
---|---|
String |
getBase()
Return the fully qualified base name of the ResourceBundle instances we are wrapping. |
protected ResourceBundle |
getBundle(Locale locale)
Return the appropriate ResourceBundle instance
that corresponds to the specified locale parameter. |
protected ClassLoader |
getClassLoader()
Return the ClassLoader for which we are mapping
ResourceBundle instances. |
Iterator |
getKeys()
Return an Iterator over the defined keys in this
Resources instance. |
Object |
getObject(String key,
Locale locale)
Return the content for the specified key as an
Object, localized based on the specified locale . |
Methods inherited from class org.apache.commons.resources.impl.ResourcesBase |
---|
destroy, getBufferSize, getBytes, getInputStream, getName, getReader, getString, init, isReturnNull, setBufferSize, setReturnNull |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ResourceBundleResources(String name, String base)
Create a new Resources
instance with the specified
logical name and bundle base name.
name
- Logical name of the new instancebase
- Fully qualified base name of the ResourceBundle
instances to be wrappedMethod Detail |
---|
public String getBase()
Return the fully qualified base name of the
ResourceBundle
instances we are wrapping.
public Iterator getKeys()
Return an Iterator
over the defined keys in this
Resources
instance.
getKeys
in interface Resources
getKeys
in class ResourcesBase
public Object getObject(String key, Locale locale)
Return the content for the specified key
as an
Object, localized based on the specified locale
.
getObject
in interface Resources
getObject
in class ResourcesBase
key
- Identifier for the requested contentlocale
- Locale with which to localize retrieval,
or null
for the default Locale
ResourcesException
- if an error occurs retrieving or
returning the requested content
ResourcesKeyException
- if the no value for the specified
key was found, and isReturnNull()
returns
false
protected ResourceBundle getBundle(Locale locale) throws MissingResourceException
Return the appropriate ResourceBundle
instance
that corresponds to the specified locale
parameter.
The first time a particular bundle is requested, cache it so
that subsequent requests will operate more quickly.
locale
- Locale with which to localize retrieval,
or null
for the default Locale
MissingResourceException
- if the requested Resourcebundle
cannot be acquiredprotected ClassLoader getClassLoader()
Return the ClassLoader
for which we are mapping
ResourceBundle
instances.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |