public class StandardMessageResolver extends AbstractMessageResolver
Standard implementation of IMessageResolver
.
A message in template /WEB-INF/templates/home.html for locale ll_CC-vv ("ll" = language, "CC" = country, "vv" = variant) would be looked for in .properties files in the following sequence:
Constructor and Description |
---|
StandardMessageResolver() |
Modifier and Type | Method and Description |
---|---|
void |
addDefaultMessage(String key,
String value)
Adds a new message to the set of default messages.
|
void |
clearDefaultMessages()
Clears the set of default messages.
|
Properties |
getDefaultMessages()
Returns the default messages.
|
MessageResolution |
resolveMessage(Arguments arguments,
String key,
Object[] messageParameters)
Resolve the message, returning a
MessageResolution object. |
void |
setDefaultMessages(Properties defaultMessages)
Sets the default messages.
|
protected Properties |
unsafeGetDefaultMessages()
Unsafe method meant only for use by subclasses.
|
checkInitialized, checkNotInitialized, getName, getOrder, initialize, initializeSpecific, isInitialized, setName, setOrder, unsafeGetName, unsafeGetOrder
public Properties getDefaultMessages()
Returns the default messages. These messages will be used if no other messages can be found.
protected Properties unsafeGetDefaultMessages()
Unsafe method meant only for use by subclasses.
public void setDefaultMessages(Properties defaultMessages)
Sets the default messages. These messages will be used if no other messages can be found.
defaultMessages
- the new default messagespublic void addDefaultMessage(String key, String value)
Adds a new message to the set of default messages.
key
- the message keyvalue
- the message value (text)public void clearDefaultMessages()
Clears the set of default messages.
public MessageResolution resolveMessage(Arguments arguments, String key, Object[] messageParameters)
IMessageResolver
Resolve the message, returning a MessageResolution
object.
If the message cannot be resolved, this method should return null.
arguments
- the Arguments
object being used for template processingkey
- the message keymessageParameters
- the (optional) message parametersMessageResolution
object containing the resolved message.Copyright © 2017 The THYMELEAF team. All rights reserved.