|
||||||||||
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(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. |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected AbstractValidationMessage(String text, Severity severity)
text
- describes this messageseverity
- this message's severity, either error or warning
IllegalArgumentException
- if severity
is OK
protected 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 view
IllegalArgumentException
- if severity
is OK
Method Detail |
---|
public final Severity severity()
severity
in interface ValidationMessage
public String formattedText()
formattedText
in interface ValidationMessage
protected 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 ValidationMessage
protected final void setKey(Object associationKey)
associationKey
- the key to be setpublic String toString()
toString
in class Object
Object.toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |