org.thymeleaf.messageresolver
Class StandardMessageResolver

Object
  extended by org.thymeleaf.messageresolver.AbstractMessageResolver
      extended by org.thymeleaf.messageresolver.StandardMessageResolver
All Implemented Interfaces:
IMessageResolver

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:

Since:
1.0
Author:
Daniel Fernández

Constructor Summary
StandardMessageResolver()
           
 
Method Summary
 void addDefaultMessage(String key, String value)
           Adds a new message to the set of default messages.
 void clearDefaultMessages()
           Clears the set of default messages.
 java.util.Properties getDefaultMessages()
           Returns the default messages.
 MessageResolution resolveMessage(Arguments arguments, String key, Object[] messageParameters)
           Resolve the message, returning a MessageResolution object.
 void setDefaultMessages(java.util.Properties defaultMessages)
           Sets the default messages.
protected  java.util.Properties unsafeGetDefaultMessages()
           Unsafe method meant only for use by subclasses.
 
Methods inherited from class org.thymeleaf.messageresolver.AbstractMessageResolver
checkInitialized, checkNotInitialized, getName, getOrder, initialize, initializeSpecific, isInitialized, setName, setOrder, unsafeGetName, unsafeGetOrder
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StandardMessageResolver

public StandardMessageResolver()
Method Detail

getDefaultMessages

public java.util.Properties getDefaultMessages()

Returns the default messages. These messages will be used if no other messages can be found.

Returns:
the default messages

unsafeGetDefaultMessages

protected java.util.Properties unsafeGetDefaultMessages()

Unsafe method meant only for use by subclasses.

Returns:
the default messages

setDefaultMessages

public void setDefaultMessages(java.util.Properties defaultMessages)

Sets the default messages. These messages will be used if no other messages can be found.

Parameters:
defaultMessages - the new default messages

addDefaultMessage

public void addDefaultMessage(String key,
                              String value)

Adds a new message to the set of default messages.

Parameters:
key - the message key
value - the message value (text)

clearDefaultMessages

public void clearDefaultMessages()

Clears the set of default messages.


resolveMessage

public MessageResolution resolveMessage(Arguments arguments,
                                        String key,
                                        Object[] messageParameters)
Description copied from interface: IMessageResolver

Resolve the message, returning a MessageResolution object.

If the message cannot be resolved, this method should return null.

Parameters:
arguments - the Arguments object being used for template processing
key - the message key
messageParameters - the (optional) message parameters
Returns:
a MessageResolution object containing the resolved message.


Copyright © 2012 The THYMELEAF team. All Rights Reserved.