public class NlsMessagePlain extends Object implements NlsMessage
NlsMessage that only returns the message given at
construction and never has any arguments.| Modifier and Type | Field and Description |
|---|---|
private String |
message |
private static long |
serialVersionUID |
LOCALIZATION_FAILURE_PREFIXKEY_ANNOTATION, KEY_ARGUMENT, KEY_CAPACITY, KEY_CONTAINER, KEY_DEFAULT, KEY_DIRECTORY, KEY_ERROR, KEY_EXISTING, KEY_EXPECTED, KEY_FILE, KEY_FUNCTION, KEY_ID, KEY_KEY, KEY_LOCATION, KEY_MAX, KEY_MIN, KEY_MODE, KEY_NAME, KEY_OBJECT, KEY_OPERAND, KEY_OPERATION, KEY_OPTION, KEY_PATH, KEY_PROPERTY, KEY_QUERY, KEY_RESOURCE, KEY_SIZE, KEY_SOURCE, KEY_TARGET_TYPE, KEY_TITLE, KEY_TYPE, KEY_URI, KEY_USER, KEY_VALUE| Modifier | Constructor and Description |
|---|---|
protected |
NlsMessagePlain()
The constructor for de-serialization in GWT.
|
|
NlsMessagePlain(String message)
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
getArgument(int index)
Deprecated.
|
Object |
getArgument(String key)
This method gets the language independent argument value for the given
key. |
int |
getArgumentCount()
Deprecated.
|
String |
getInternationalizedMessage()
This method gets the internationalized message what is the actual message template for the
root
locale without resolving its NlsArguments. |
String |
getLocalizedMessage()
|
String |
getLocalizedMessage(Locale locale)
This method gets the resolved and localized message.
First it will translate the
internationalized message to the given Locale. |
void |
getLocalizedMessage(Locale locale,
Appendable buffer)
This method writes the
localized message to the given buffer. |
String |
getLocalizedMessage(Locale locale,
NlsTemplateResolver resolver)
This method gets the localized message as string.
|
void |
getLocalizedMessage(Locale locale,
NlsTemplateResolver resolver,
Appendable buffer)
This method writes the localized message to the given
buffer. |
String |
getMessage()
This method gets the untranslated message (default language should be English) with arguments filled in.
|
NlsMessage |
toNlsMessage()
This method is the equivalent to
Object.toString() with native language support. |
String |
toString() |
private static final long serialVersionUID
private String message
protected NlsMessagePlain()
public NlsMessagePlain(String message)
message - is the plain message to return for any locale without modification.public NlsMessage toNlsMessage()
NlsObjectObject.toString() with native language support.toNlsMessage in interface NlsObjectpublic String getInternationalizedMessage()
NlsMessageroot
locale without resolving its NlsArguments.getInternationalizedMessage in interface NlsMessage"Welcome {name}!").NlsMessage,
NlsMessage.getArgument(String),
MessageFormat@Deprecated public int getArgumentCount()
NlsMessagegetArgumentCount in interface NlsMessagepublic Object getArgument(String key)
NlsMessagekey.getArgument in interface NlsMessagekey - is the name of the requested argument.null if NOT defined.NlsArgument@Deprecated public Object getArgument(int index)
NlsMessageindex.getArgument in interface NlsMessageindex - is the index of the requested argument.public String getMessage()
NlsMessageNlsMessage.getLocalizedMessage(Locale) instead of this method.getMessage in interface NlsMessageNlsMessage.getLocalizedMessage(Locale, NlsTemplateResolver)public String getLocalizedMessage()
NlsMessagelocalized message as String using the
default Locale. In the simplest case Locale.getDefault() is used but if available
LocaleContextHolder from spring is used.NlsMessage.getLocalizedMessage(Locale) instead.getLocalizedMessage in interface NlsMessagepublic String getLocalizedMessage(Locale locale)
NlsMessagetranslate the
internationalized message to the given Locale. If this fails for
whatever reason, the internationalized message is used as fallback.arguments with their according
values.internationalized message is "Welcome {name}!"
and the argument with the key @c"name" has the value "Joelle". After
translation to Locale.GERMAN the message may be "Willkommen {name}!". This results in the
resolved message "Willkommen Joelle!". If the German localization was not present or has a syntax error,
the root locale is used as fallback result in "Welcome Joelle!".getLocalizedMessage in interface NlsMessagelocale - is the locale to translate to.net.sf.mmm.util.nls.apipublic void getLocalizedMessage(Locale locale, Appendable buffer)
NlsMessagegetLocalizedMessage in interface NlsMessagelocale - is the locale to translate to.buffer - is the buffer where to write the message to.NlsMessage.getLocalizedMessage(Locale)public String getLocalizedMessage(Locale locale, NlsTemplateResolver resolver)
NlsMessagegetLocalizedMessage in interface NlsMessagelocale - is the locale to translate to.resolver - is used to translate the message.NlsMessage.getLocalizedMessage(Locale, NlsTemplateResolver, Appendable)public void getLocalizedMessage(Locale locale, NlsTemplateResolver resolver, Appendable buffer)
NlsMessagebuffer. template that is provided via the given resolver.
If this fails, the original message will be used. After translation is done,
the language independent arguments will be filled in the translated message string according to the given
locale.getLocalizedMessage in interface NlsMessagelocale - is the locale to translate to.resolver - is used to resolve the template required to translate the internationalized message.buffer - is the buffer where to write the message to.Copyright © 2001–2016 mmm-Team. All rights reserved.