net.sf.shineframework.common.messages
Class MessageImpl

java.lang.Object
  extended by net.sf.shineframework.common.messages.MessageImpl
All Implemented Interfaces:
java.io.Serializable, Message

public class MessageImpl
extends java.lang.Object
implements Message

A basic implementation of a message. This type of message retrieves the localized message phrase from the Localizer.

Author:
amirk
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface net.sf.shineframework.common.messages.Message
Message.Severity
 
Constructor Summary
MessageImpl(MessageDef def)
          Creates a concrete message with the current timestamp
 
Method Summary
 void addParam(java.lang.String value)
          adds a param value to the message.
 void addParams(java.lang.Object... values)
          add several (or all) params at once
 java.lang.String getKey()
          retrieves the message key.
 java.lang.String getMessage()
          retrieves the localized message with the default locale as defined in the localizer
 java.lang.String getMessage(java.util.Locale l)
          retrieves the localized message from the localizer according to the locale
 java.util.Collection<java.lang.Object> getParams()
          Returns an immutable collection of the message params
 Message.Severity getSeverity()
          retrieves the message severity
 java.util.Date getTimestamp()
          retrieves the message creation timestamp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageImpl

public MessageImpl(MessageDef def)
Creates a concrete message with the current timestamp

Method Detail

addParam

public void addParam(java.lang.String value)
adds a param value to the message. Call this method in the order of the params you require to set in a message.

Specified by:
addParam in interface Message
Parameters:
value - the param value to add

addParams

public void addParams(java.lang.Object... values)
add several (or all) params at once

Specified by:
addParams in interface Message
Parameters:
values - param values to add in the order they appear in the message phrase

getKey

public java.lang.String getKey()
retrieves the message key. The message key is the name that is searched in the resource bundle to retrieve the localized message

Specified by:
getKey in interface Message
Returns:
message key
See Also:
Localizer

getMessage

public java.lang.String getMessage()
Description copied from interface: Message
retrieves the localized message with the default locale as defined in the localizer

Specified by:
getMessage in interface Message
Returns:

getMessage

public java.lang.String getMessage(java.util.Locale l)
Description copied from interface: Message
retrieves the localized message from the localizer according to the locale

Specified by:
getMessage in interface Message
Returns:

getParams

public java.util.Collection<java.lang.Object> getParams()
Description copied from interface: Message
Returns an immutable collection of the message params

Specified by:
getParams in interface Message
Returns:

getSeverity

public Message.Severity getSeverity()
retrieves the message severity

Specified by:
getSeverity in interface Message
Returns:
severity

getTimestamp

public java.util.Date getTimestamp()
retrieves the message creation timestamp

Specified by:
getTimestamp in interface Message
Returns:
creation timestamp


Copyright © 2007 sourceforge.net. All Rights Reserved.