Class NLS
java.lang.Object
org.apache.lucene.queryparser.flexible.messages.NLS
- Direct Known Subclasses:
QueryParserMessages
MessageBundles classes extend this class, to implement a bundle.
For Native Language Support (NLS), system of software internationalization.
This interface is similar to the NLS class in eclipse.osgi.util.NLS class - initializeMessages() method resets the values of all static strings, should only be called by classes that extend from NLS (see TestMessages.java for reference) - performs validation of all message in a bundle, at class load time - performs per message validation at runtime - see NLSTest.java for usage reference
MessageBundle classes may subclass this type.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringstatic StringgetLocalizedMessage(String key, Object... args) static StringgetLocalizedMessage(String key, Locale locale) static StringgetLocalizedMessage(String key, Locale locale, Object... args) private static ObjectgetResourceBundleObject(String messageKey, Locale locale) protected static voidinitializeMessages(String bundleName, Class<? extends NLS> clazz) Initialize a given class with the message bundle Keys Should be called from a class that extends NLS in a static block at class load time.private static voidprivate static voidloadfieldValue(Field field, Class<? extends NLS> clazz) private static voidvalidateMessage(String key, Class<? extends NLS> clazz)
-
Field Details
-
bundles
-
-
Constructor Details
-
NLS
protected NLS()
-
-
Method Details
-
getLocalizedMessage
-
getLocalizedMessage
-
getLocalizedMessage
-
getLocalizedMessage
-
initializeMessages
Initialize a given class with the message bundle Keys Should be called from a class that extends NLS in a static block at class load time.- Parameters:
bundleName- Property file with that contains the message bundleclazz- where constants will reside
-
getResourceBundleObject
-
load
-
loadfieldValue
-
validateMessage
- Parameters:
key- - Message Key
-