|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.iscreen.ValidationFailureImpl
public class ValidationFailureImpl
A validation failure represents a single failure reported by a Validator
(Validators can report multiple failures, each represented by a separate
instance of this class). Each failure has a message (usually designed
to be accessible to the end user), a label (usually used to associate
the failure with an UI component, though a label is not required), and
the Collection of fields (these are really the OGNL expressions used to 'get'
properties from the JavaBean being validated) from the JavaBean that was
originally validated (normally, there's just one field).
Interface code (such as a web framework) can use instances of this
class to display the validation failures. There should be sufficient
information associated with each failure to apply the message to
the correct location within the interface.
Field Summary | |
---|---|
protected java.lang.Object |
failureBean
|
protected java.util.Collection |
fields
|
protected java.lang.Integer |
index
|
protected java.lang.String |
label
|
protected java.lang.String |
message
|
protected java.util.Map |
messages
|
protected java.lang.String |
name
|
protected int |
severity
|
protected ValidationTrace |
trace
|
Fields inherited from interface org.iscreen.ValidationFailure |
---|
CRITICAL, FAILURE, WARNING |
Constructor Summary | |
---|---|
ValidationFailureImpl()
Default constructor. |
Method Summary | |
---|---|
void |
addMessage(java.lang.String name,
java.lang.String theMessage)
Adds a named message. |
void |
addMessages(java.util.Map moreMessages)
Adds a map of messages to the set of messages that can be retrieved from getMessage( messageName ). |
java.lang.Object |
getFailureBean()
Obtains a reference to the bean that failed validation. |
java.util.Collection |
getFields()
Retrieves the fields (the OGNL expression used to 'get' the properties from the JavaBean being validated) of the JavaBean being validated. |
java.lang.Integer |
getIndex()
Retrieves the index of the JavaBean/Object being validated that was an element within an array/Collection of a 'parent' JavaBean being validated (i.e. |
java.lang.String |
getLabel()
Retrieves the label associated with this failure. |
java.lang.String |
getMessage()
Retrieves the failure message (which has already been evaluated and localized. |
java.lang.String |
getMessage(java.lang.String messageName)
Retrieves the failure message based upon the message name. |
java.lang.String |
getName()
Retrieves the name of the validator reporting the failure message. |
int |
getSeverity()
Retrieves the severity of the failure (i.e. |
ValidationTrace |
getTrace()
Retrieves the trace of the failure. |
void |
setFailureBean(java.lang.Object theFailureBean)
Sets a reference to the bean that failed validation. |
void |
setFields(java.util.Collection theFields)
|
void |
setIndex(java.lang.Integer theIndex)
|
void |
setLabel(java.lang.String theLabel)
|
void |
setMessage(java.lang.String theMessage)
|
void |
setName(java.lang.String theName)
Sets the name for this failure message. |
void |
setSeverity(int theSeverity)
Sets the severity of this failure. |
void |
setTrace(ValidationTrace theTrace)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String label
protected java.lang.String name
protected java.lang.String message
protected java.util.Collection fields
protected java.lang.Integer index
protected java.util.Map messages
protected int severity
protected ValidationTrace trace
protected java.lang.Object failureBean
Constructor Detail |
---|
public ValidationFailureImpl()
Method Detail |
---|
public void setLabel(java.lang.String theLabel)
public java.lang.String getLabel()
getLabel
in interface ValidationFailure
public void setName(java.lang.String theName)
theName
- The name of the validator causing this failure.public java.lang.String getName()
getName
in interface ValidationFailure
public java.lang.String getMessage()
getMessage
in interface ValidationFailure
public void setMessage(java.lang.String theMessage)
public java.lang.String getMessage(java.lang.String messageName)
ValidationFailure
getMessage
in interface ValidationFailure
messageName
- The 'name' of the message (defined in
the configuration.
public void addMessages(java.util.Map moreMessages)
moreMessages
- Map of messages to add.public void addMessage(java.lang.String name, java.lang.String theMessage)
name
- The name or key of the message.theMessage
- The message.public java.util.Collection getFields()
getFields
in interface ValidationFailure
public void setFields(java.util.Collection theFields)
public java.lang.Integer getIndex()
getIndex
in interface ValidationFailure
public void setIndex(java.lang.Integer theIndex)
public void setSeverity(int theSeverity)
theSeverity
- The severity of this failure.public int getSeverity()
ValidationFailure
getSeverity
in interface ValidationFailure
public void setTrace(ValidationTrace theTrace)
public ValidationTrace getTrace()
ValidationFailure
getTrace
in interface ValidationFailure
public void setFailureBean(java.lang.Object theFailureBean)
theFailureBean
- A reference to the beanpublic java.lang.Object getFailureBean()
getFailureBean
in interface ValidationFailure
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |