org.openbp.common.generic.msgcontainer
Class StandardMsgContainer

java.lang.Object
  extended by org.openbp.common.generic.msgcontainer.StandardMsgContainer
All Implemented Interfaces:
java.io.Serializable, MsgContainer

public class StandardMsgContainer
extends java.lang.Object
implements MsgContainer, java.io.Serializable

Standard implementation of a message container. The class will collect all messages that are added. The messages can be retrieved using the getMsgs() method.

Author:
Heiko Erhardt
See Also:
Serialized Form

Constructor Summary
StandardMsgContainer()
          Default constructor.
 
Method Summary
 void addMsg(MsgItem msg)
          Adds a message to the message list.
 void addMsg(java.lang.Object source, java.lang.String msg)
          Adds a message to the message list.
 void addMsg(java.lang.Object source, java.lang.String msg, java.lang.Object[] args)
          Adds a message to the message list.
 void addMsg(java.lang.String msgType, java.lang.Object source, java.lang.String msg)
          Adds a message to the message list.
 void addMsg(java.lang.String msgType, java.lang.Object source, java.lang.String msg, java.lang.Object[] args)
          Adds a message to the message list.
 void clearMsgs()
          Clears the message list.
 java.util.List getList()
          Gets the message list.
 java.util.Iterator getMsgs()
          Gets the message list.
 boolean isEmpty()
          Checks if the message container contains messages.
 java.lang.String toString()
          Returns a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StandardMsgContainer

public StandardMsgContainer()
Default constructor.

Method Detail

addMsg

public void addMsg(java.lang.Object source,
                   java.lang.String msg,
                   java.lang.Object[] args)
Adds a message to the message list. The message will be formatted according to the rules specified in the MsgFormat class.

Specified by:
addMsg in interface MsgContainer
Parameters:
source - Object that caused the message
msg - Message to add
args - Message arguments or null

addMsg

public void addMsg(java.lang.Object source,
                   java.lang.String msg)
Adds a message to the message list.

Specified by:
addMsg in interface MsgContainer
Parameters:
source - Object that caused the message
msg - Message to add

addMsg

public void addMsg(java.lang.String msgType,
                   java.lang.Object source,
                   java.lang.String msg,
                   java.lang.Object[] args)
Adds a message to the message list. The message will be formatted according to the rules specified in the MsgFormat class.

Specified by:
addMsg in interface MsgContainer
Parameters:
msgType - Message type
source - Object that caused the message
msg - Message to add
args - Message arguments or null

addMsg

public void addMsg(java.lang.String msgType,
                   java.lang.Object source,
                   java.lang.String msg)
Adds a message to the message list.

Specified by:
addMsg in interface MsgContainer
Parameters:
msgType - Message type
source - Object that caused the message
msg - Message to add

toString

public java.lang.String toString()
Returns a string representation of this object.

Overrides:
toString in class java.lang.Object
Returns:
The string representation lists all messages that have been added to the message container. The messages will be separated by the '\n' character.
The object that caused the message will display its qualified name if it implements the PrintNameProvider interface or its name if it implements the DescriptionObject interface. Otherwise, the toString representation of the object will be printed.
If there are no messages present, the empty string will be returned.

isEmpty

public boolean isEmpty()
Checks if the message container contains messages.


getMsgs

public java.util.Iterator getMsgs()
Gets the message list.

Returns:
An iterator of MsgItem objects

getList

public java.util.List getList()
Gets the message list.

Returns:
A list of MsgItem objects or null if there are no messages

addMsg

public void addMsg(MsgItem msg)
Adds a message to the message list.

Parameters:
msg - The message to add

clearMsgs

public void clearMsgs()
Clears the message list.



Copyright © 2011. All Rights Reserved.