public class NlsBundleHelper extends AbstractLoggableObject
NlsBundle
interfaces.Modifier and Type | Field and Description |
---|---|
static NlsBundleHelper |
INSTANCE |
Constructor and Description |
---|
NlsBundleHelper()
The constructor.
|
Modifier and Type | Method and Description |
---|---|
NlsArgumentDescriptor[] |
getArguments(Method method) |
NlsMessageDescriptor |
getDescriptor(Method method) |
static NlsBundleHelper |
getInstance() |
String |
getKey(Method method) |
String |
getMessage(Method method) |
private String |
getName(Annotation[] annotations,
int i) |
ClassName |
getQualifiedLocation(Class<? extends NlsBundle> nlsBundleInterface)
This method gets the location of the
ResourceBundle base name for the given NlsBundle
interface. |
ResourceBundle |
getResourceBundle(String qualifiedBundleName,
Locale locale) |
boolean |
isNlsBundleMethod(Method method,
boolean ignoreIllegalMethods)
|
ResourceBundle |
toResourceBundle(Class<? extends NlsBundle> bundleClass)
Converts the given
NlsBundle class to a ResourceBundle . |
getLogger
public static final NlsBundleHelper INSTANCE
getInstance()
public static NlsBundleHelper getInstance()
public ClassName getQualifiedLocation(Class<? extends NlsBundle> nlsBundleInterface)
ResourceBundle
base name for the given NlsBundle
interface.nlsBundleInterface
- is the NlsBundle
interface.ResourceBundle
base name for the given NlsBundle
interface.public String getKey(Method method)
method
- is the Method
of a NlsBundle
.key
of the Method
(defaults to Method.getName()
if not
annotated with NlsBundleKey
).public ResourceBundle getResourceBundle(String qualifiedBundleName, Locale locale)
qualifiedBundleName
- the qualified name
of the ResourceBundle
to load.locale
- the Locale
to translate to.ResourceBundle
.public String getMessage(Method method)
method
- the NlsBundle
Method
.bundle message
or null
if not present.public NlsMessageDescriptor getDescriptor(Method method)
method
- the NlsBundle
Method
.NlsMessageDescriptor
for the given Method
.public NlsArgumentDescriptor[] getArguments(Method method)
method
- is the Method
of a NlsBundle
.NlsArgumentDescriptor
s describing the method parameters.private String getName(Annotation[] annotations, int i)
public ResourceBundle toResourceBundle(Class<? extends NlsBundle> bundleClass)
NlsBundle
class to a ResourceBundle
.bundleClass
- is the class reflecting a NlsBundle
.ResourceBundle
with the key/value pairs of the given bundleClass
for
Locale.ROOT
.public boolean isNlsBundleMethod(Method method, boolean ignoreIllegalMethods)
method
- the Method
to check.ignoreIllegalMethods
- - true
if illegal methods (non NlsBundleMethods other than those defined by
Object
) should be ignored, false
if they should cause an exception.true
if the given Method
is a legal NlsBundle
method, false
otherwise (e.g.
for toString()
).Copyright © 2001–2016 mmm-Team. All rights reserved.