net.sourceforge.stripes.validation.expression
Class ExpressionValidator

java.lang.Object
  extended by net.sourceforge.stripes.validation.expression.ExpressionValidator

public class ExpressionValidator
extends Object

A Facade to the classes that perform expression based validation. Hides the fact that we might be using one of many implementations to actually run expression validation. When the ExpressionExecutor is first requested an attempt is made to find the best working executor available. The following classes will be tried in turn until a working instance is found:

Since:
Stripes 1.5
Author:
Tim Fennell

Constructor Summary
ExpressionValidator()
           
 
Method Summary
static void evaluate(ActionBean bean, ParameterName name, List<Object> values, ValidationMetadata validationInfo, ValidationErrors errors)
          Run expression validation on the bean property provided with the values provided.
static ExpressionExecutor getExecutor()
          Gets the executor that will be used to run expression evaluation.
static void initialize()
          Attempts to instantiate executor classes (as described in the class level javadoc) until a working one is found.
static void setExecutor(ExpressionExecutor executor)
          Allows anyone who is interested to substitute a different ExpressionExecutor instance instead of the one picked by the ExpressionValidator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExpressionValidator

public ExpressionValidator()
Method Detail

initialize

public static void initialize()
Attempts to instantiate executor classes (as described in the class level javadoc) until a working one is found.


evaluate

public static void evaluate(ActionBean bean,
                            ParameterName name,
                            List<Object> values,
                            ValidationMetadata validationInfo,
                            ValidationErrors errors)
Run expression validation on the bean property provided with the values provided.

Parameters:
bean - the ActionBean being validated
name - the ParameterName object representing the parameter being validated
values - the values to be validated (zero or more)
validationInfo - the validation metadata for the named property
errors - the ValidationErrors for the property, to be added to

getExecutor

public static ExpressionExecutor getExecutor()
Gets the executor that will be used to run expression evaluation. If none is yet set the initialize() method will be run to set one up.

Returns:
an instance of ExpressionExecutor that can be used to execute validation expressions

setExecutor

public static void setExecutor(ExpressionExecutor executor)
Allows anyone who is interested to substitute a different ExpressionExecutor instance instead of the one picked by the ExpressionValidator.

Parameters:
executor - the executor to use from now on


? Copyright 2005-2006, Stripes Development Team.