|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--org.apache.commons.resources.impl.ResourcesBase
|
+--org.apache.commons.resources.impl.ResourceBundleResources
Concrete implementation of
Resources that wraps a set
(one per Locale) of java.util.ResourceBundle instances
that share a common base name. The timeZone argument
is ignored in all resource getter method implementations.
| Constructor Summary | |
ResourceBundleResources(String name,
String base)
Create a new Resources
instance with the specified
logical name and bundle base name. |
|
| Method Summary | |
void |
destroy()
This method must be called when the manager of this resource decides that it's no longer needed. |
String |
getBase()
Return the fully qualified base name of the ResourceBundle instances we are wrapping. |
protected ResourceBundle |
getBundle(Locale locale,
TimeZone timeZone)
Return the appropriate ResourceBundle instance
that corresponds to the specified locale and
timeZone parameters. |
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,
TimeZone timeZone)
Return the content for the specified key as an
Object, localized based on the specified locale
and/or timeZone. |
void |
init()
This must be called to initialize the data content of this Resources instance, before any of the getXxx()
methods are called. |
| Methods inherited from class org.apache.commons.resources.impl.ResourcesBase |
getBufferSize, getBytes, getInputStream, getName, getReader, getString, 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 wrapped| Method Detail |
public void init()
throws ResourcesException
This must be called to initialize the data content of this
Resources instance, before any of the getXxx()
methods are called.
init in class ResourcesBaseResourcesException - if an error occurs during initialization
public void destroy()
throws ResourcesException
This method must be called when the manager of this resource
decides that it's no longer needed. After this method is called,
no further calls to any of the getXxx() methods are
allowed.
destroy in class ResourcesBaseResourcesException - if an error occurs during finalizationpublic 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 class ResourcesBase
public Object getObject(String key,
Locale locale,
TimeZone timeZone)
Return the content for the specified key as an
Object, localized based on the specified locale
and/or timeZone.
getObject in class ResourcesBasekey - Identifier for the requested contentlocale - Locale with which to localize retrieval,
or null for the default LocaletimeZone - TimeZone with which to localize retrieval,
or null for the default TimeZoneResourcesException - if an error occurs retrieving or
returning the requested contentResourcesKeyException - if the no value for the specified
key was found, and isReturnNull() returns
false
protected ResourceBundle getBundle(Locale locale,
TimeZone timeZone)
throws MissingResourceException
Return the appropriate ResourceBundle instance
that corresponds to the specified locale and
timeZone parameters. The first time a particular
bundle is requested, cache it so that subsequent requests will
operate more quickly.
The default implementation of this method unconditionally ignores the
timeZone argument.
locale - Locale with which to localize retrieval,
or null for the default LocaletimeZone - TimeZone with which to localize retrieval,
or null for the default TimeZoneMissingResourceException - 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: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||