org.iscreen
Class ValidationFailure

java.lang.Object
  extended by org.iscreen.ValidationFailure

public class ValidationFailure
extends java.lang.Object

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.

Author:
Shellman, Dan

Field Summary
protected  java.util.Collection fields
           
protected  java.lang.Integer index
           
protected  java.lang.String label
           
protected  java.lang.String message
           
 
Constructor Summary
ValidationFailure()
          Default constructor.
 
Method Summary
 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.
 void setFields(java.util.Collection theFields)
           
 void setIndex(java.lang.Integer theIndex)
           
 void setLabel(java.lang.String theLabel)
           
 void setMessage(java.lang.String theMessage)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

label

protected java.lang.String label

message

protected java.lang.String message

fields

protected java.util.Collection fields

index

protected java.lang.Integer index
Constructor Detail

ValidationFailure

public ValidationFailure()
Default constructor.

Method Detail

setLabel

public void setLabel(java.lang.String theLabel)

getLabel

public java.lang.String getLabel()
Retrieves the label associated with this failure.

Returns:
Returns the label associated with this failure.

getMessage

public java.lang.String getMessage()
Retrieves the failure message (which has already been evaluated and localized.

Returns:
Returns the failure message.

setMessage

public void setMessage(java.lang.String theMessage)

getFields

public 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.

Returns:
Returns the fields of the JavaBean being validated.

setFields

public void setFields(java.util.Collection theFields)

getIndex

public 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. an object was being validated, and it had a property that was an array/Collection that was 'forwarded' on to another validation set and iterated over. The subsequent members of that array/Collection would have an index of which was being validated at a particular time. This is that index.). If no indexed property was being validated, then this will return null. Note that a null value is different than a zero value, as a zero value represents the first element in an array/Collection, where a null value implies that the JavaBean/Object wasn't involved in an array/Collection in the first place.

Returns:
Returns the index of the JavaBean/Object that was being validated.

setIndex

public void setIndex(java.lang.Integer theIndex)