org.iscreen.impl
Class ContextBean

java.lang.Object
  extended by org.iscreen.impl.ContextBean

public class ContextBean
extends java.lang.Object

This class represents the JavaBean that's used to evaluate OGNL expressions. Failure messages and documentation may reference this JavaBean to reference its properties. Note that certain properties are certain lifecycles (meaning, they are valid at certain times). For example, the failure property is only available during runtime, after a validation has been performed (and a failure has been discovered). Therefore, it's not "valid" to reference it within documentation. Note the lifecycles of each property on the getters/setters.

Author:
Shellman, Dan

Field Summary
protected  java.lang.Object bean
           
protected  java.lang.Object failure
           
protected  java.util.Collection fields
           
protected  java.lang.Integer index
           
protected  java.lang.String label
           
protected  Validator validator
           
 
Constructor Summary
ContextBean()
          Default constructor.
 
Method Summary
 java.lang.Object getBean()
          The JavaBean being validated can be retrieved by failure messages, since the bean is set prior to validation (prior to any validators being called).
 java.lang.Object getFailure()
          The failure object, which represents an object associated with a particular failure (and failure message), is available to failure messages, as it's set prior to them being evaluated.
 java.util.Collection getFields()
          Returns the fields, which are OGNL 'getter' expressions.
 java.lang.Integer getIndex()
          Gets the index of this OGNL root.
 java.lang.String getLabel()
          The label is available during runtime, prior to any validators being called (prior to validation).
 Validator getValidator()
          The Validator is available during runtime, prior to any validators being called (prior to validation).
 void setBean(java.lang.Object theBean)
          The JavaBean being validated is set during runtime, prior to any validators being called (prior to validation).
 void setFailure(java.lang.Object theFailure)
          The failure object, which represents an object associated with a particular failure (and failure message), is set during validation, when a validator reports the failure.
 void setFields(java.util.Collection theFields)
          The fields, which are a collection of OGNL 'getter' expressions meant to map from the JavaBean (or object) being validated to the validation bean used by the Validator, are set prior to validation.
 void setIndex(int theIndex)
          Sets the index of this OGNL root.
 void setLabel(java.lang.String theLabel)
          The label is set during runtime, prior to any validators being called (prior to validation).
 void setValidator(Validator theValidator)
          The Validator is set during runtime, prior to any validators being called (prior to validation).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bean

protected java.lang.Object bean

label

protected java.lang.String label

failure

protected java.lang.Object failure

validator

protected Validator validator

fields

protected java.util.Collection fields

index

protected java.lang.Integer index
Constructor Detail

ContextBean

public ContextBean()
Default constructor.

Method Detail

setBean

public void setBean(java.lang.Object theBean)
The JavaBean being validated is set during runtime, prior to any validators being called (prior to validation).

Parameters:
theBean - The JavaBean being validated.

getBean

public java.lang.Object getBean()
The JavaBean being validated can be retrieved by failure messages, since the bean is set prior to validation (prior to any validators being called).

Returns:
Returns the JavaBean being validated.

setLabel

public void setLabel(java.lang.String theLabel)
The label is set during runtime, prior to any validators being called (prior to validation). In fact, the label is set during configuration of the ValidationService.

Parameters:
theLabel - The label associated with a particular validation.

getLabel

public java.lang.String getLabel()
The label is available during runtime, prior to any validators being called (prior to validation). In fact, the label is set during configuration of the ValidationService.

Returns:
Returns the label associated with a particular validation.

setValidator

public void setValidator(Validator theValidator)
The Validator is set during runtime, prior to any validators being called (prior to validation). It has the same lifecycle as the label.

Parameters:
theValidator - The validator being used.

getValidator

public Validator getValidator()
The Validator is available during runtime, prior to any validators being called (prior to validation). It has the same lifecycle as the label.

Returns:
Returns the Validator that is currently being called.

setFailure

public void setFailure(java.lang.Object theFailure)
The failure object, which represents an object associated with a particular failure (and failure message), is set during validation, when a validator reports the failure.

Parameters:
theFailure - The failure object set by a Validator during validation (associated with a failure message).

getFailure

public java.lang.Object getFailure()
The failure object, which represents an object associated with a particular failure (and failure message), is available to failure messages, as it's set prior to them being evaluated.

Returns:
Return the failure object set by a Validator during validation (associated with a failure message).

setFields

public void setFields(java.util.Collection theFields)
The fields, which are a collection of OGNL 'getter' expressions meant to map from the JavaBean (or object) being validated to the validation bean used by the Validator, are set prior to validation.

Parameters:
theFields - The Collection of fields (or OGNL 'getter' expressions).

getFields

public java.util.Collection getFields()
Returns the fields, which are OGNL 'getter' expressions. These are set prior to validation.

Returns:
Returns the fields (OGNL 'getter' expressions) being validated.

setIndex

public void setIndex(int theIndex)
Sets the index of this OGNL root. This index is used when a JavaBean/Object has a property that is some form of array/Collection that is being validated across. The index represents the particular object within the array/Collection that is being validated. This property is set prior to validation of the indexed property (but not necessarily before the parent is validated).

Parameters:
theIndex - The index of the JavaBean property being validated.

getIndex

public java.lang.Integer getIndex()
Gets the index of this OGNL root. This index is used when a JavaBean/Object has a property that is some form of array/Collection that is being validated across. The index represents the particular object within the array/Collection that is being validated. If a JavaBean/Object is NOT being used in this way (such as the parent JavaBean), then this method will return null (note that null is NOT the same as zero, since zero is the first index in an array/Collection, where null means that there is no array/Collection being validated).

Returns:
Returns the index of the JavaBean property being validated.