public abstract class AbstractValidationMessage extends Object implements ValidationMessage, Serializable
ValidationMessage interface. Holds the severity, a text message,
and the association key.
Subclasses should implement #equals and #hashCode
to prevent unnecessary change notifications for the result property
when a ValidationResultModel gets a new ValidationResult. See for example
the implementation of method PropertyValidationMessage.equals(Object).
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractValidationMessage(String text,
Severity severity)
Constructs an AbstractValidationMessage for the given text and Severity.
|
protected |
AbstractValidationMessage(String text,
Severity severity,
Object key)
Constructs an AbstractValidationMessage for the given text,
Severity, and association key.
|
| Modifier and Type | Method and Description |
|---|---|
String |
formattedText()
Returns a message description as formatted text.
|
Object |
key()
Returns this message's association key that can be used to model
a loose coupling between validation messages and views that present
the validated data.
|
protected void |
setKey(Object associationKey)
Sets the given object as new association key.
|
Severity |
severity()
Returns this message's severity, either error or warning.
|
protected String |
text()
Returns this validation message's text.
|
String |
toString()
Returns a string representation of this validation message.
|
protected AbstractValidationMessage(String text, Severity severity)
text - describes this messageseverity - this message's severity, either error or warningIllegalArgumentException - if severity is OKprotected AbstractValidationMessage(String text, Severity severity, Object key)
text - describes this messageseverity - this message's severity, either error or warningkey - used to determine whether this message belongs
to a given viewIllegalArgumentException - if severity is OKpublic final Severity severity()
severity in interface ValidationMessagepublic String formattedText()
formattedText in interface ValidationMessageprotected final String text()
public Object key()
Subclasses may override this method to return keys that are built from
other internal data. For example, the PropertyValidationMessage
returns the aspect as key.
See the class comment for more information about this relation.
key in interface ValidationMessageprotected final void setKey(Object associationKey)
associationKey - the key to be setpublic String toString()
toString in class ObjectObject.toString()Copyright © 2003-2014 JGoodies Software GmbH. All Rights Reserved.