fi.hu.cs.titokone
Class Message

java.lang.Object
  extended byfi.hu.cs.titokone.Message

public class Message
extends java.lang.Object

This class represents a translatable message to the user. It uses the Translator class statically to deal with the actual translation.


Field Summary
private  java.lang.String messageKey
           
private  java.lang.String[] parameters
           
 
Constructor Summary
Message(java.lang.String messageKey)
          This constructor sets up a static message.
Message(java.lang.String templateKey, java.lang.String parameter)
          This constructor sets up a message with modifiable parts, and sets what they will be replaced with.
Message(java.lang.String templateKey, java.lang.String[] parameters)
          This constructor sets up a message with modifiable parts, and sets what they will be replaced with.
 
Method Summary
 java.lang.String toString()
          This method translates the message and does any necessary replacement of parameters into the string itself.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

messageKey

private java.lang.String messageKey

parameters

private java.lang.String[] parameters
Constructor Detail

Message

public Message(java.lang.String messageKey)
This constructor sets up a static message.

Parameters:
messageKey - The identifying key, possibly equal to the default English message. The value is used to find the translation.

Message

public Message(java.lang.String templateKey,
               java.lang.String parameter)
This constructor sets up a message with modifiable parts, and sets what they will be replaced with.

Parameters:
templateKey - The identifying key, possibly equal to the default English message. The value is used to find the translation.
parameter - The value to replace a {0} marker in the template message.

Message

public Message(java.lang.String templateKey,
               java.lang.String[] parameters)
This constructor sets up a message with modifiable parts, and sets what they will be replaced with.

Parameters:
templateKey - The identifying key, possibly equal to the default English message. The value is used to find the translation.
parameters - The values to replace {i} markers in the template message in order. If there are less strings in the array than there are markers, the remaining markers will show as such in the resulting string. If there are more strings in the array than are needed, the final ones are ignored.
Method Detail

toString

public java.lang.String toString()
This method translates the message and does any necessary replacement of parameters into the string itself. The translated message is formed over for each time toString() is called; if the locale is changed between two calls to the toString() of the same instance of Message, the results may be different. See Translator for details.

Returns:
The translated string.