org.mentawai.message
Class AbstractMessage

java.lang.Object
  extended by org.mentawai.message.AbstractMessage
All Implemented Interfaces:
Message
Direct Known Subclasses:
DefaultMessage

public abstract class AbstractMessage
extends Object
implements Message

Author:
Sergio Oliveira

Field Summary
protected  MessageContext context
           
protected  String id
           
protected  String[] params
           
protected  String tokenMarker
           
protected  Map<String,String> tokens
           
 
Constructor Summary
AbstractMessage(int id, MessageContext context)
           
AbstractMessage(int id, MessageContext context, Map<String,String> tokens)
           
AbstractMessage(int id, MessageContext context, Map<String,String> tokens, String[] params)
           
AbstractMessage(String id, MessageContext context)
           
AbstractMessage(String id, MessageContext context, Map<String,String> tokens)
           
AbstractMessage(String id, MessageContext context, Map<String,String> tokens, String[] params)
           
 
Method Summary
 MessageContext getContext()
          Gets the message context for this message.
 String getId()
          Gets the unique ID of this message.
 String[] getParams()
          Gets params for this message.
 String getText(Locale loc)
          Gets the message text this message object represents.
 Map<String,String> getTokens()
          Gets tokens or placeholders for this message.
 void setTokenMarker(String tokenMarker)
           
 void setTokens(Map<String,String> tokens)
          Sets tokens or placeholders for this message.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

id

protected String id

context

protected MessageContext context

tokens

protected Map<String,String> tokens

tokenMarker

protected String tokenMarker

params

protected String[] params
Constructor Detail

AbstractMessage

public AbstractMessage(String id,
                       MessageContext context)

AbstractMessage

public AbstractMessage(String id,
                       MessageContext context,
                       Map<String,String> tokens)

AbstractMessage

public AbstractMessage(String id,
                       MessageContext context,
                       Map<String,String> tokens,
                       String[] params)

AbstractMessage

public AbstractMessage(int id,
                       MessageContext context)

AbstractMessage

public AbstractMessage(int id,
                       MessageContext context,
                       Map<String,String> tokens)

AbstractMessage

public AbstractMessage(int id,
                       MessageContext context,
                       Map<String,String> tokens,
                       String[] params)
Method Detail

getId

public String getId()
Description copied from interface: Message
Gets the unique ID of this message. A message context cannot have two messages with the same id.

Specified by:
getId in interface Message
Returns:
The unique id of this message.

getTokens

public Map<String,String> getTokens()
Description copied from interface: Message
Gets tokens or placeholders for this message.

Specified by:
getTokens in interface Message

getContext

public MessageContext getContext()
Description copied from interface: Message
Gets the message context for this message.

Specified by:
getContext in interface Message
Returns:
The message context for this message.

getParams

public String[] getParams()
Description copied from interface: Message
Gets params for this message.

Specified by:
getParams in interface Message

setTokenMarker

public void setTokenMarker(String tokenMarker)

setTokens

public void setTokens(Map<String,String> tokens)
Description copied from interface: Message
Sets tokens or placeholders for this message. A message can have tokens.

Specified by:
setTokens in interface Message
Parameters:
tokens - The tokens for this message.

getText

public String getText(Locale loc)
Description copied from interface: Message
Gets the message text this message object represents.

Specified by:
getText in interface Message
Parameters:
loc - The locale of the message.
Returns:
The message text.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013. All Rights Reserved.