org.pm4j.core.pm
Class PmMessage

java.lang.Object
  extended by org.pm4j.core.pm.PmMessage
Direct Known Subclasses:
PmValidationMessage

public class PmMessage
extends java.lang.Object

A string resource based presentation model message.


Nested Class Summary
static class PmMessage.Severity
           
static class PmMessage.SubMessageList
          A list that can be used to pass a set of submessages as message argument.
 
Constructor Summary
PmMessage(PmObject pm, PmMessage.Severity severity, java.lang.String msgKey, java.lang.Object... msgArgs)
           
PmMessage(PmObject pm, PmMessage.Severity severity, java.lang.Throwable cause, java.lang.String msgKey, java.lang.Object... msgArgs)
          Constructor for messages that are caused by an exception.
 
Method Summary
 java.lang.Throwable getCause()
           
 java.lang.Object[] getMsgArgs()
           
 java.lang.String getMsgKey()
           
 PmObject getPm()
           
 PmMessage.Severity getSeverity()
           
 java.lang.String getTitle()
           
 java.lang.String getTooltip()
           
 boolean isError()
           
 boolean isInfo()
           
 boolean isWarning()
           
protected  java.lang.String localize(java.lang.String resKey, java.lang.Object... resStringArgs)
           
protected  java.lang.String localizeOptional(java.lang.String resKey, java.lang.Object... resStringArgs)
           
 void setCause(java.lang.Throwable cause)
          Defines a message causing exception.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PmMessage

public PmMessage(PmObject pm,
                 PmMessage.Severity severity,
                 java.lang.String msgKey,
                 java.lang.Object... msgArgs)
Parameters:
pm - The PM this message is related to.
severity - Message severity.
msgKey - The resource string key.
msgArgs - Arguments for the resource string.

PmMessage

public PmMessage(PmObject pm,
                 PmMessage.Severity severity,
                 java.lang.Throwable cause,
                 java.lang.String msgKey,
                 java.lang.Object... msgArgs)
Constructor for messages that are caused by an exception.

Parameters:
pm - The PM this message is related to.
severity - Message severity.
cause - An optional exception that caused this message.
msgKey - The resource string key.
msgArgs - Arguments for the resource string.
Method Detail

getPm

public PmObject getPm()
Returns:
The related PM instance. Is never null.

getSeverity

public PmMessage.Severity getSeverity()

isError

public boolean isError()
Returns:
true in case of severity PmMessage.Severity.ERROR.

isWarning

public boolean isWarning()
Returns:
true in case of severity PmMessage.Severity.WARN.

isInfo

public boolean isInfo()
Returns:
true in case of severity PmMessage.Severity.INFO.

getMsgKey

public java.lang.String getMsgKey()

getMsgArgs

public java.lang.Object[] getMsgArgs()

getTitle

public java.lang.String getTitle()

getTooltip

public java.lang.String getTooltip()

setCause

public void setCause(java.lang.Throwable cause)
Defines a message causing exception.

Parameters:
cause - The exception that caused this message.

getCause

public java.lang.Throwable getCause()
Returns:
An optional exception that caused this message.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

localize

protected java.lang.String localize(java.lang.String resKey,
                                    java.lang.Object... resStringArgs)

localizeOptional

protected java.lang.String localizeOptional(java.lang.String resKey,
                                            java.lang.Object... resStringArgs)