net.sf.mmm.util.nls.base
Class AbstractResourceBundle
java.lang.Object
java.util.ResourceBundle
net.sf.mmm.util.nls.base.AbstractResourceBundle
- Direct Known Subclasses:
- NlsBundleUtilCore
public abstract class AbstractResourceBundle
- extends ResourceBundle
This is the abstract base class for ResourceBundle implementations
using this NLS support. Create your ResourceBundles by sub-classing
this class and simply define some public static final fields that will be
automatically added to the bundle using reflection (only from constructor).
Please note that your sub-class must also be public or you need to set
privileges in the security manager to allow this class reading the fields via
reflection.
Please also follow the convention using the following prefixes followed by a
suffix that properly explains what the text is about:
| Prefix |
Comment |
Example |
| ERR_ |
Text for an exception message. |
ERR_VALUE_NOT_SET = "The value \"{value}\" is not set!" |
| MSG_ |
Text for a complete information message. |
MSG_MAIN_OPTION_VERSION_USAGE = "Print the program-version." |
| INF_ |
Text for a single information term. |
INF_MAIN_MODE_DEFAULT = "default" |
| INT_ |
Reserved for internal constants not to be localized. |
INT_MAIN_OPTION_NAME_VERSION = "--version" |
- Since:
- 1.0.0
- Author:
- Joerg Hohwiller (hohwille at users.sourceforge.net)
- See Also:
NlsBundleUtilCore
| Methods inherited from class java.util.ResourceBundle |
clearCache, clearCache, containsKey, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getLocale, getObject, getString, getStringArray, handleKeySet, keySet, setParent |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PREFIX_INTERNAL_FIELD
private static final String PREFIX_INTERNAL_FIELD
- Fields that start with this prefix ("INT_" ), will be ignored as
bundle properties.
- See Also:
- Constant Field Values
bundle
private Hashtable<String,Object> bundle
- The key value pairs; maps keys (String) to values (Object). No Map because
Enumeration is required...
reverse
private Map<Object,String> reverse
- the inverse map of
bundle
AbstractResourceBundle
public AbstractResourceBundle()
- The constructor.
getKey
public String getKey(Object object)
- This method is the inverse of
ResourceBundle.getObject(String).
- Parameters:
object - is the object (potentially) retrieved via
ResourceBundle.getObject(String).
- Returns:
- the key for the given
object or null if
it was NOT retrieved via ResourceBundle.getObject(String) from this
instance.
getKeys
public Enumeration<String> getKeys()
-
- Specified by:
getKeys in class ResourceBundle
handleGetObject
protected Object handleGetObject(String key)
-
- Specified by:
handleGetObject in class ResourceBundle
Copyright © 2001-2010 mmm-Team. All Rights Reserved.