com.scooterframework.common.util
Class ExpandedMessage

java.lang.Object
  extended by com.scooterframework.common.util.Message
      extended by com.scooterframework.common.util.ExpandedMessage
All Implemented Interfaces:
java.io.Serializable

public class ExpandedMessage
extends Message

ExpandedMessage represents a parsed message the content of which is a combination of the message associated with the messageKey stored in a resource file and the values related to the message.

When there is no message associated with the messageKey in resource files, the messageKey itself is used as the message for parsing.

See Also:
Serialized Form

Field Summary
protected  java.lang.String messageKey
          The key to content in resource file.
 
Fields inherited from class com.scooterframework.common.util.Message
content, createdAt, id
 
Constructor Summary
ExpandedMessage(java.lang.String messageKey)
          Construct a message.
ExpandedMessage(java.lang.String id, java.lang.String messageKey)
          Construct a message.
ExpandedMessage(java.lang.String id, java.lang.String messageKey, java.lang.Object value)
          Construct a message with a specific replacement value.
ExpandedMessage(java.lang.String id, java.lang.String messageKey, java.lang.Object[] values)
          Construct a message with specific replacement values.
ExpandedMessage(java.lang.String id, java.lang.String messageKey, java.lang.Object value0, java.lang.Object value1)
          Construct a message with a specific replacement value.
ExpandedMessage(java.lang.String id, java.lang.String messageKey, java.lang.Object value0, java.lang.Object value1, java.lang.Object value2)
          Construct a message with a specific replacement value.
 
Method Summary
 java.lang.String getContent()
          Gets the content for this message.
 java.lang.String getMessageKey()
          Gets the messageKey for this message.
 java.lang.String toString()
          Returns a String in the format: key[value1, value2, etc].
 
Methods inherited from class com.scooterframework.common.util.Message
getId, getTimestamp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

messageKey

protected java.lang.String messageKey

The key to content in resource file.

Constructor Detail

ExpandedMessage

public ExpandedMessage(java.lang.String messageKey)

Construct a message.

Parameters:
messageKey - a string representing a key in a resource file

ExpandedMessage

public ExpandedMessage(java.lang.String id,
                       java.lang.String messageKey)

Construct a message.

Parameters:
id - Message id
messageKey - a string representing a key in a resource file

ExpandedMessage

public ExpandedMessage(java.lang.String id,
                       java.lang.String messageKey,
                       java.lang.Object value)

Construct a message with a specific replacement value.

Parameters:
id - Message id
messageKey - a string representing a key in a resource file
value - a value that can be used in the message

ExpandedMessage

public ExpandedMessage(java.lang.String id,
                       java.lang.String messageKey,
                       java.lang.Object value0,
                       java.lang.Object value1)

Construct a message with a specific replacement value.

Parameters:
id - Message id
messageKey - a string representing a key in a resource file
value0 - a value that can be used in the message
value1 - a value that can be used in the message

ExpandedMessage

public ExpandedMessage(java.lang.String id,
                       java.lang.String messageKey,
                       java.lang.Object value0,
                       java.lang.Object value1,
                       java.lang.Object value2)

Construct a message with a specific replacement value.

Parameters:
id - Message id
messageKey - a string representing a key in a resource file
value0 - a value that can be used in the message
value1 - a value that can be used in the message
value2 - a value that can be used in the message

ExpandedMessage

public ExpandedMessage(java.lang.String id,
                       java.lang.String messageKey,
                       java.lang.Object[] values)

Construct a message with specific replacement values.

Parameters:
id - Message id
messageKey - a string representing a key in a resource file
values - an array of values that can be used in the message
Method Detail

getContent

public java.lang.String getContent()

Gets the content for this message.

Overrides:
getContent in class Message
Returns:
The content for this message

getMessageKey

public java.lang.String getMessageKey()

Gets the messageKey for this message.

Returns:
The messageKey for this message

toString

public java.lang.String toString()

Returns a String in the format: key[value1, value2, etc].

Overrides:
toString in class Message
Returns:
String representation of this message
See Also:
Object.toString()