net.sourceforge.stripes.action
Class LocalizableMessage

java.lang.Object
  extended by net.sourceforge.stripes.action.SimpleMessage
      extended by net.sourceforge.stripes.action.LocalizableMessage
All Implemented Interfaces:
Serializable, Message

public class LocalizableMessage
extends SimpleMessage

A non-error message class that can localize (or at least externalize) the message String in a resource bundle. The bundle used is the Stripes error message bundle, which can be configured but by default is called 'StripesResources.properties'. In all other ways this class behaves like it's parent SimpleMessage.

Author:
Tim Fennell
See Also:
Serialized Form

Constructor Summary
LocalizableMessage(String messageKey, Object... parameter)
          Creates a new LocalizableMessage with the message key provided, and optionally zero or more replacement parameters to use in the message.
 
Method Summary
 boolean equals(Object o)
          Generated equals method which will return true if the other object is of the same type as this instance, and would produce the same user message.
protected  String getMessageTemplate(Locale locale)
          Method responsible for using the information supplied to the message object to find a message template.
 int hashCode()
          Generated hashCode method.
 
Methods inherited from class net.sourceforge.stripes.action.SimpleMessage
getMessage, getMessage, getReplacementParameters
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalizableMessage

public LocalizableMessage(String messageKey,
                          Object... parameter)
Creates a new LocalizableMessage with the message key provided, and optionally zero or more replacement parameters to use in the message.

Parameters:
messageKey - a key to lookup a message in the resource bundle
parameter - one or more replacement parameters to insert into the message
Method Detail

getMessageTemplate

protected String getMessageTemplate(Locale locale)
Method responsible for using the information supplied to the message object to find a message template. In this class this is done simply by looking up the resource corresponding to the messageKey supplied in the constructor.

Overrides:
getMessageTemplate in class SimpleMessage
Parameters:
locale - the Locale of the message template desired
Returns:
the message (potentially with TextFormat replacement tokens).

equals

public boolean equals(Object o)
Generated equals method which will return true if the other object is of the same type as this instance, and would produce the same user message.

Overrides:
equals in class SimpleMessage
Parameters:
o - an instance of LocalizableMessage or subclass thereof
Returns:
true if the two messages would produce the same user message, false otherwise

hashCode

public int hashCode()
Generated hashCode method.

Overrides:
hashCode in class SimpleMessage


? Copyright 2005-2006, Stripes Development Team.