com.opensymphony.xwork.validator
Class AbstractActionValidatorManager

java.lang.Object
  extended by com.opensymphony.xwork.validator.AbstractActionValidatorManager
All Implemented Interfaces:
ActionValidatorManager
Direct Known Subclasses:
DefaultActionValidatorManager

public abstract class AbstractActionValidatorManager
extends Object
implements ActionValidatorManager

An abstract implementation of ActionValidatorManager interface that contains the logics of validating action objects and utlity methods common to all subclass eg. method to build validator key ( buildValidatorKey(Class, String) ) that subclass will be interested in when eg. saving the ValidatorConfig in a Map cache.

This class could serves as the base class for example DefaultActionValidatorManager which reads in the validation configuration information through <action-class-name>-<action-alias>-validation.xml or <action-class-name>-validation.xml xml file format or a custom ActionValidatorManager that reads in the validation configuration through annotation where the diference between them is just how to get the validation configuration information (in this example, through xml and annotation respectively).

Version:
$Date$ $Id$
Author:
tmjee

Nested Class Summary
protected  class AbstractActionValidatorManager.InternalValidatorContextWrapper
          An ValidatorContext wrapper that returns the full field name AbstractActionValidatorManager.InternalValidatorContextWrapper.getFullFieldName(String) by consulting it's parent if its an VisitorFieldValidator.AppendingValidatorContext.
 
Constructor Summary
AbstractActionValidatorManager()
           
 
Method Summary
protected  String buildValidatorKey(Class clazz, String context)
          Builds a key for validators - used when caching validators.
protected  List buildValidatorsFromValidatorConfig(List validatorConfigs)
           
 void validate(Object object, List validators, ValidatorContext validatorContext)
          Validates an action through a series of validators with the given validatorContext
 void validate(Object object, String context)
          Validates the given object using action and its context.
 void validate(Object object, String context, ValidatorContext validatorContext)
          Validates an action give its context and a validation context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.opensymphony.xwork.validator.ActionValidatorManager
getValidators
 

Constructor Detail

AbstractActionValidatorManager

public AbstractActionValidatorManager()
Method Detail

validate

public void validate(Object object,
                     String context)
              throws ValidationException
Validates the given object using action and its context.

Specified by:
validate in interface ActionValidatorManager
Parameters:
object - the action to validate.
context - the action's context.
Throws:
ValidationException - if an error happens when validating the action.

validate

public void validate(Object object,
                     String context,
                     ValidatorContext validatorContext)
              throws ValidationException
Validates an action give its context and a validation context.

Specified by:
validate in interface ActionValidatorManager
Parameters:
object - the action to validate.
context - the action's context.
validatorContext -
Throws:
ValidationException - if an error happens when validating the action.

validate

public void validate(Object object,
                     List validators,
                     ValidatorContext validatorContext)
              throws ValidationException
Validates an action through a series of validators with the given validatorContext

Specified by:
validate in interface ActionValidatorManager
Parameters:
object -
validators -
validatorContext -
Throws:
ValidationException

buildValidatorKey

protected String buildValidatorKey(Class clazz,
                                   String context)
Builds a key for validators - used when caching validators.

Parameters:
clazz - the action.
context - the action's context.
Returns:
a validator key which is the class name plus context.

buildValidatorsFromValidatorConfig

protected List buildValidatorsFromValidatorConfig(List validatorConfigs)

WebWork Project Page