public interface NlsBundleWithLookup extends NlsBundle, NlsMessageLookup
NlsBundle
s that require generic lookup
of a
NlsMessage
. getMessage(String, Map)
is really required. Otherwise only extend
NlsBundle
.INTERFACE_NAME_SUFFIX
Modifier and Type | Method and Description |
---|---|
NlsMessage |
getMessage(String methodName,
Map<String,Object> nlsArguments)
|
NlsMessage getMessage(String methodName, Map<String,Object> nlsArguments)
NlsMessage
for the given key
with the given nlsArguments
.
This allows generic access to invoke a specific method of your bundle. E.g. assume you have an interface
NlsBundleMyExampleRoot
extending NlsMessageLookup
that declares the following method:
@NlsBundleMessage("The object \"{object}\" is null!") NlsMessage errorArgumentNull(@Named("object") Object object);Then you could do:
NlsBundleMyExampleRoot myBundle =This would have the same result asNlsAccess
.getBundleFactory().createBundle(NlsBundleMyExampleRoot.class); Map<String, Object> parameters = new HashMap<>(); parameters.put("object", myObject);NlsMessage
message = myBundle.getMessage("errorArgumentNull", parameters);
myBundle.errorArgumentNull(myObject)
.getMessage
in interface NlsMessageLookup
methodName
- is the method name
.nlsArguments
- are the arguments
. May be null
for no arguments.NlsMessage
or null
if no message exists for the given methodName
(no such
method exists).Copyright © 2001–2016 mmm-Team. All rights reserved.