public class ProjectResourceBundle extends ResourceBundle
Wrapper class for resource bundles. Property files are used to store resource strings, which are the only types of resources available. Property files can inherit properties from other files so that a base property file can be used and a small number of properties can be over-ridden by another property file. For example you may create an english version of a resource file named "resource.properties". You then decide that the British English version of all of the properties except one are the same, so there is no need to redefine all of the properties in "resource_en_GB", just the one that is different.
The basename is the name of the property file without the ".properties" extension.
Properties will be cached for performance.
Property values stored in the property files can also contain dynamic variables. Any dynamic variable defined in PropertiesUtil.getVariableValue() can be used (such as {date}), as well as arguments in the form {0}, {1}, etc. Argument values are specified in the various overloaded getString() methods.
ResourceBundle.Control
Modifier and Type | Field and Description |
---|---|
protected static org.apache.commons.logging.Log |
log |
parent
Modifier and Type | Method and Description |
---|---|
static void |
clearBundleCache()
Clears the internal cache.
|
static ProjectResourceBundle |
getBundle(String projectName,
Class caller,
String resourceName,
Locale locale)
Construct a new ProjectResourceBundle
|
static ProjectResourceBundle |
getBundle(String projectName,
Class caller,
String resourceName,
Locale locale,
ResourceBundle extendsBundle)
Construct a new ProjectResourceBundle
|
static ProjectResourceBundle |
getBundle(String projectName,
String packageName,
String resourceName)
Construct a new ProjectResourceBundle
|
static ProjectResourceBundle |
getBundle(String projectName,
String packageName,
String resourceName,
Locale locale,
ClassLoader loader)
Construct a new ProjectResourceBundle
|
static ProjectResourceBundle |
getBundle(String projectName,
String packageName,
String resourceName,
Locale locale,
ClassLoader loader,
ResourceBundle extendsBundle)
Construct a new ProjectResourceBundle
|
Enumeration |
getKeys() |
String |
getResourceName() |
protected Object |
handleGetObject(String key) |
String |
toString() |
clearCache, clearCache, containsKey, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getLocale, getObject, getString, getStringArray, handleKeySet, keySet, setParent
protected Object handleGetObject(String key) throws MissingResourceException
handleGetObject
in class ResourceBundle
MissingResourceException
public Enumeration getKeys()
getKeys
in class ResourceBundle
public static ProjectResourceBundle getBundle(String projectName, String packageName, String resourceName) throws MissingResourceException
projectName
- The name of the project to which the class belongs.
It must be a proper prefix of the caller's package.caller
- The calling class.
This is used to get the package name to further construct
the basename as well as to get the proper ClassLoader.resourceName
- The name of the resource without the
".properties" extensionMissingResourceException
- if projectName is not a prefix of
the caller's package name, or if the resource could not be
found/loaded.public static ProjectResourceBundle getBundle(String projectName, Class caller, String resourceName, Locale locale) throws MissingResourceException
projectName
- The name of the project to which the class belongs.
It must be a proper prefix of the caller's package.caller
- The calling class.
This is used to get the package name to further construct
the basename as well as to get the proper ClassLoader.resourceName
- The name of the resource without the
".properties" extensionMissingResourceException
- if projectName is not a prefix of
the caller's package name, or if the resource could not be
found/loaded.public static ProjectResourceBundle getBundle(String projectName, String packageName, String resourceName, Locale locale, ClassLoader loader) throws MissingResourceException
projectName
- The name of the project to which the class belongs.
It must be a proper prefix of the caller's package.caller
- The calling class.
This is used to get the package name to further construct
the basename as well as to get the proper ClassLoader.resourceName
- The name of the resource without the
".properties" extensionlocale
- The localeMissingResourceException
- if projectName is not a prefix of
the caller's package name, or if the resource could not be
found/loaded.public static ProjectResourceBundle getBundle(String projectName, Class caller, String resourceName, Locale locale, ResourceBundle extendsBundle) throws MissingResourceException
projectName
- The name of the project to which the class belongs.
It must be a proper prefix of the caller's package.caller
- The calling class.
This is used to get the package name to further construct
the basename as well as to get the proper ClassLoader.resourceName
- The name of the resource without the
".properties" extensionlocale
- The localeextendsBundle
- If non-null, then this ExtendMessages will
default to extendsBundle.MissingResourceException
- if projectName is not a prefix of
the caller's package name, or if the resource could not be
found/loaded.public static ProjectResourceBundle getBundle(String projectName, String packageName, String resourceName, Locale locale, ClassLoader loader, ResourceBundle extendsBundle) throws MissingResourceException
projectName
- The name of the project to which the class belongs.
It must be a proper prefix of the caller's package.caller
- The calling class.
This is used to get the package name to further construct
the basename as well as to get the proper ClassLoader.resourceName
- The name of the resource without the
".properties" extensionlocale
- The localeextendsBundle
- If non-null, then this ExtendMessages will
default to extendsBundle.MissingResourceException
- if projectName is not a prefix of
the caller's package name, or if the resource could not be
found/loaded.public String getResourceName()
public static void clearBundleCache()
Note: In Axis 1.4 this method was named clearCache
. However, that name conflicts
with a method in the base class introduced in Java 1.6.
Copyright © The Apache Software Foundation. All Rights Reserved.