|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.jgoodies.validation.message.AbstractValidationMessage
public abstract class AbstractValidationMessage
An abstract class that minimizes the effort required to implement the
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).
| Constructor Summary | |
|---|---|
protected |
AbstractValidationMessage(java.lang.String text,
Severity severity)
Constructs an AbstractValidationMessage for the given text and Severity. |
protected |
AbstractValidationMessage(java.lang.String text,
Severity severity,
java.lang.Object key)
Constructs an AbstractValidationMessage for the given text, Severity, and association key. |
| Method Summary | |
|---|---|
java.lang.String |
formattedText()
Returns a message description as formatted text. |
java.lang.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(java.lang.Object associationKey)
Sets the given object as new association key. |
Severity |
severity()
Returns this message's severity, either error or warning. |
protected java.lang.String |
text()
Returns this validation message's text. |
java.lang.String |
toString()
Returns a string representation of this validation message. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
protected AbstractValidationMessage(java.lang.String text,
Severity severity)
text - describes this messageseverity - this message's severity, either error or warning
java.lang.IllegalArgumentException - if severity is Severity.OK
protected AbstractValidationMessage(java.lang.String text,
Severity severity,
java.lang.Object key)
text - describes this messageseverity - this message's severity, either error or warningkey - used to determine whether this message belongs
to a given view
java.lang.IllegalArgumentException - if severity is Severity.OK| Method Detail |
|---|
public final Severity severity()
severity in interface ValidationMessagepublic java.lang.String formattedText()
formattedText in interface ValidationMessageprotected final java.lang.String text()
public java.lang.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(java.lang.Object associationKey)
associationKey - the key to be setpublic java.lang.String toString()
toString in class java.lang.ObjectObject.toString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||