org.dspace.app.xmlui.wing
Class Message

java.lang.Object
  extended by org.dspace.app.xmlui.wing.Message
All Implemented Interfaces:
Serializable

public class Message
extends Object
implements Serializable

This class represents an i18n message, which is composed of three parts: a catalogue, a key, and a set of dictionary parameters. The catalogue tells the translator where to find the key, the key tells the transformer which specific text should be used, and the parameters are provided for non-translated data to be inserted into the resulting string. This class is designed in such a way that the Message object can be made static by any class that needs to use it. If dicionary parameters are used then a new instance is created specifically for those parameters, this prevents concurrent threads from overwriting each other's parameters.

Author:
Scott Phillips
See Also:
Serialized Form

Field Summary
protected  String catalogue
          What catalogue this key is to be found in.
protected  String key
          The key to look up in the catalogue.
 
Constructor Summary
Message(String catalogue, String key)
          Create a new translatable element.
 
Method Summary
 String getCatalogue()
           
 Object[] getDictionaryParameters()
          Return any dictionary parameters that are used by this translation message.
 String getKey()
           
 Message parameterize(Object... dictionaryParameters)
          Parameterize this translate key by specifying dictionary parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

catalogue

protected final String catalogue
What catalogue this key is to be found in.


key

protected final String key
The key to look up in the catalogue.

Constructor Detail

Message

public Message(String catalogue,
               String key)
Create a new translatable element.

Parameters:
catalogue - The catalogue where this key can be found.
key - The key to look up in the catalogue.
Method Detail

getCatalogue

public String getCatalogue()
Returns:
The catalogue where this key can be found.

getKey

public String getKey()
Returns:
The key to look-up in the catalogue.

parameterize

public Message parameterize(Object... dictionaryParameters)
Parameterize this translate key by specifying dictionary parameters. This will not modify the current translate object but instead create a cloned copy that has been parameterized.

Parameters:
dictionaryParameters - The dictionary parameters

getDictionaryParameters

public Object[] getDictionaryParameters()
Return any dictionary parameters that are used by this translation message. Since this is the basic implementation it does not support parameters we just return an empty array.

Returns:
Any parameters to the catalogue key


Copyright © 2012 DuraSpace. All Rights Reserved.