|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.resources.impl.ResourcesBase
org.apache.commons.resources.impl.CollectionResourcesBase
org.apache.commons.resources.impl.PropertyResources
public class PropertyResources
Concrete implementation of
Resources that wraps a family
(one per Locale) of properties files that share a base URL
and have name suffixes reflecting the Locale for which
the document's messages apply. Resources are looked up in a hierarchy
of properties files in a manner identical to that performed by
java.util.ResourceBundle.getBundle()..
The base URL passed to our constructor must contain the base name
of the properties file family.
For example, if the configuration URL is passed as
http://localhost/foo/Bar, the resources for the
en_US Locale would be stored under URL
http://localhost/foo/Bar_en_US.properties, and the default
resources would be stored in
http://localhost/foo/Bar.properties.
| Constructor Summary | |
|---|---|
PropertyResources(String name,
String base)
Create a new Resources instance with the specified
logical name and base resource URL. |
|
| Method Summary | |
|---|---|
protected Map |
getLocaleMap(String baseUrl,
Locale locale)
Return a Map containing the name-value mappings for
the specified base URL and requested Locale, if there
are any. |
| Methods inherited from class org.apache.commons.resources.impl.CollectionResourcesBase |
|---|
destroy, getDefaultLocale, getKeys, getLocaleList, getLocaleMap, getLocaleSuffix, getObject, setDefaultLocale |
| Methods inherited from class org.apache.commons.resources.impl.ResourcesBase |
|---|
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 PropertyResources(String name,
String base)
Create a new
Resources instance with the specified
logical name and base resource URL.
name - Logical name of the new instancebase - Base URL of the family of properties files that contain
the resource keys and values| Method Detail |
|---|
protected Map getLocaleMap(String baseUrl,
Locale locale)
Return a Map containing the name-value mappings for
the specified base URL and requested Locale, if there
are any. If there are no defined mappings for the specified
Locale, return an empty Map instead.
Concrete subclasses must override this method to perform the
appropriate lookup. A typical implementation will construct an
absolute URL based on the specified base URL and Locale,
retrieve the specified resource file (if any), and parse it into
a Map structure.
Caching of previously retrieved Maps (if any) should
be performed by callers of this method. Therefore, this method should
always attempt to retrieve the specified resource and load it
appropriately.
getLocaleMap in class CollectionResourcesBasebaseUrl - Base URL of the resource files for this
Resources instancelocale - Locale for which name-value mappings
are requested
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||