|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.metamatrix.api.core.message.DefaultMessage
public class DefaultMessage
The default implementation of Message. The presence of each of the three properties (text, type, or target) is
optional. A few pre-defined message types have been defined for which messages can be created using one
of several static create methods. In addition, a "null" message may be created that does not allow for
any associated text or target. Attempts to set either the text or a target on a null message will throw an
IllegalStateException.
Warnings:
| Field Summary |
|---|
| Fields inherited from interface com.metamatrix.api.core.message.MessageTypes |
|---|
ERROR_MESSAGE, NOTIFICATION_MESSAGE, NULL_MESSAGE, WARNING_MESSAGE |
| Constructor Summary | |
|---|---|
DefaultMessage()
Creates a new null message (with no text or target). |
|
DefaultMessage(Message message)
Creates a new message using the properties of the specified message. |
|
DefaultMessage(java.lang.String text)
Creates a new notification message containing the specified text and no target. |
|
DefaultMessage(java.lang.String text,
int type)
Creates a new message of the specified type containing the specified text and no target. |
|
DefaultMessage(java.lang.String text,
int type,
java.lang.Object target)
Creates a new message of the specified type containing the specified text and target. |
|
| Method Summary | |
|---|---|
void |
clear()
Clears the content of this message, which simply sets the message type to be null and clears the text and target. |
protected void |
constructDefaultMessage(java.lang.String text,
int type,
java.lang.Object target)
Initializes all of this message's properties using the specified values. |
static Message |
createErrorMessage(java.lang.String text)
Creates a new error message containing the specified text and no target. |
static Message |
createErrorMessage(java.lang.String text,
java.lang.Object target)
Creates a new error message containing the specified text and target. |
static Message |
createNotificationMessage(java.lang.String text)
Creates a new notification message containing the specified text and no target. |
static Message |
createNotificationMessage(java.lang.String text,
java.lang.Object target)
Creates a new notification message containing the specified text and target. |
static Message |
createWarningMessage(java.lang.String text)
Creates a new warning message containing the specified text and no target. |
static Message |
createWarningMessage(java.lang.String text,
java.lang.Object target)
Creates a new warning message containing the specified text and target. |
boolean |
equals(java.lang.Object object)
Overridden to indicate messages are equal as long as their properties (text, type, and target) are equal. |
java.lang.Object |
getTarget()
Gets the target object to which this message applies. |
java.lang.String |
getText()
Gets the text describing this message. |
int |
getType()
Gets the message type. |
int |
hashCode()
Return the hash code for this object. |
void |
set(java.lang.String text)
Sets the message text to the specified value, the type to a notification message, and the target to null. |
void |
set(java.lang.String text,
int type)
Sets the message text and type to the specified values, and the target to null. |
void |
set(java.lang.String text,
int type,
java.lang.Object target)
Sets all of this message's properties using the specified values. |
void |
setMessage(Message message)
Sets all of this message's properties using the property values from the specified message. |
void |
setTarget(java.lang.Object target)
Sets the message target. |
void |
setText(java.lang.String text)
Sets the message text. |
void |
setType(int type)
Sets the message type. |
java.lang.String |
toString()
Return the message text. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultMessage()
public DefaultMessage(java.lang.String text)
text - The message text
public DefaultMessage(java.lang.String text,
int type)
text - The message texttype - The message type
public DefaultMessage(java.lang.String text,
int type,
java.lang.Object target)
text - The message texttype - The message typetarget - The message targetpublic DefaultMessage(Message message)
message - An instance of Message| Method Detail |
|---|
public static Message createErrorMessage(java.lang.String text)
text - The message text
public static Message createErrorMessage(java.lang.String text, java.lang.Object target)
text - The message texttarget - The message target
public static Message createNotificationMessage(java.lang.String text)
text - The message text
public static Message createNotificationMessage(java.lang.String text, java.lang.Object target)
text - The message texttarget - The message target
public static Message createWarningMessage(java.lang.String text)
text - The message text
public static Message createWarningMessage(java.lang.String text, java.lang.Object target)
text - The message texttarget - The message target
public void clear()
protected void constructDefaultMessage(java.lang.String text,
int type,
java.lang.Object target)
text - The message texttype - The message typetarget - The message targetpublic boolean equals(java.lang.Object object)
equals in class java.lang.Objectobject - the Object to be compared to this object
public java.lang.Object getTarget()
public java.lang.String getText()
public int getType()
types.
NULL_MESSAGEpublic int hashCode()
equal. Note that since the hash code
is dependent upon modifiable properties, instances of this class should not be modified when stored within a hashing
collection.
hashCode in class java.lang.Objectpublic void set(java.lang.String text)
text - The message text
public void set(java.lang.String text,
int type)
text - The message texttype - The message type
public void set(java.lang.String text,
int type,
java.lang.Object target)
text - The message texttype - The message type; may be any value, although use of MessageTypes constants
are encouraged.target - The message targetpublic void setMessage(Message message)
message - An instance of Messagepublic void setTarget(java.lang.Object target)
target - The message target
java.lang.IllegalStateException - If the message type is NULL_MESSAGE.public void setText(java.lang.String text)
text - The message text
java.lang.IllegalStateException - If the message type is NULL_MESSAGE.public void setType(int type)
NULL_MESSAGE.
type - The message type; may be any value, although use of MessageTypes constants
are encouraged.public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||