org.openbp.common.generic.msgcontainer
Class MsgItem

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

public class MsgItem
extends java.lang.Object
implements java.io.Serializable

Description object of a message. The message will be formatted according to the rules specified in the MsgFormat class.
The message source references the object that caused the message.

Author:
Heiko Erhardt
See Also:
Serialized Form

Constructor Summary
MsgItem()
          Default constructor.
MsgItem(java.lang.String msgType, java.lang.Object source, java.lang.String msg, java.lang.Object[] msgArgs)
          Value constructor.
 
Method Summary
 java.lang.String getFormattedMsg()
          Gets the formatted message.
 java.lang.String getFormattedMsgWithSource()
          Gets the formatted message including message source specification.
 java.lang.String getMsg()
          Gets the message.
 java.lang.Object[] getMsgArgs()
          Gets the message arguments.
 java.lang.String getMsgType()
          Gets the message type.
 java.lang.String getSourceString()
          Gets the name of the source of the message.
 void setMsg(java.lang.String msg)
          Sets the message.
 void setMsgArgs(java.lang.Object[] msgArgs)
          Sets the message arguments.
 void setMsgType(java.lang.String msgType)
          Sets the message type.
 void setSource(java.lang.Object source)
          Sets the source of the message.
 java.lang.String toString()
          Gets 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

MsgItem

public MsgItem()
Default constructor.


MsgItem

public MsgItem(java.lang.String msgType,
               java.lang.Object source,
               java.lang.String msg,
               java.lang.Object[] msgArgs)
Value constructor.

Parameters:
msgType - Message type See the constants of LogLevel interface.
source - Source of the message (may be null)
msg - The message
msgArgs - Message arguments (may be null)
Method Detail

toString

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

Overrides:
toString in class java.lang.Object
Returns:
Same as getFormattedMsgWithSource()

getSourceString

public java.lang.String getSourceString()
Gets the name of the source of the message.

Returns:
The print name in case of a PrintNameProvider object, the name for a DescriptionObject or otherwise the result of toString(). Can be null if there is no source object for this description.

getFormattedMsgWithSource

public java.lang.String getFormattedMsgWithSource()
Gets the formatted message including message source specification.

Returns:
The formatted message or null if neither message source nor message was provided.

getFormattedMsg

public java.lang.String getFormattedMsg()
Gets the formatted message.

Returns:
The formatted message or null if no message was provided

setSource

public void setSource(java.lang.Object source)
Sets the source of the message.


getMsgType

public java.lang.String getMsgType()
Gets the message type. See the constants of LogLevel interface.


setMsgType

public void setMsgType(java.lang.String msgType)
Sets the message type. See the constants of LogLevel interface.


getMsg

public java.lang.String getMsg()
Gets the message.


setMsg

public void setMsg(java.lang.String msg)
Sets the message.


getMsgArgs

public java.lang.Object[] getMsgArgs()
Gets the message arguments.


setMsgArgs

public void setMsgArgs(java.lang.Object[] msgArgs)
Sets the message arguments.



Copyright © 2011. All Rights Reserved.