com.opensymphony.xwork.validator
Class AnnotationActionValidatorManager

java.lang.Object
  extended by com.opensymphony.xwork.validator.AnnotationActionValidatorManager
All Implemented Interfaces:
com.opensymphony.xwork.validator.ActionValidatorManager

public class AnnotationActionValidatorManager
extends Object
implements com.opensymphony.xwork.validator.ActionValidatorManager

AnnotationActionValidatorManager

This is the entry point into XWork's annotations-based validator framework. Validation rules are specified as annotations within the source files.

Version:
$Id: AnnotationActionValidatorManager.java 908 2006-03-18 13:40:08 +0100 (Sat, 18 Mar 2006) rainerh $
Author:
Rainer Hermanns, jepjep

Field Summary
protected static String VALIDATION_CONFIG_SUFFIX
          The file suffix for any validation file.
 
Constructor Summary
AnnotationActionValidatorManager()
           
 
Method Summary
protected  List<com.opensymphony.xwork.validator.ValidatorConfig> buildClassValidatorConfigs(Class aClass, boolean checkFile)
           
protected static String buildValidatorKey(Class clazz, String context)
          Builds a key for validators - used when caching validators.
 List<com.opensymphony.xwork.validator.Validator> getValidators(Class clazz, String context)
          Returns a list of validators for the given class and context.
 void validate(Object object, String context)
          Validates the given object using action and its context.
 void validate(Object object, String context, com.opensymphony.xwork.validator.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
 

Field Detail

VALIDATION_CONFIG_SUFFIX

protected static final String VALIDATION_CONFIG_SUFFIX
The file suffix for any validation file.

See Also:
Constant Field Values
Constructor Detail

AnnotationActionValidatorManager

public AnnotationActionValidatorManager()
Method Detail

getValidators

public List<com.opensymphony.xwork.validator.Validator> getValidators(Class clazz,
                                                                      String context)
Returns a list of validators for the given class and context. This is the primary lookup method for validators.

Specified by:
getValidators in interface com.opensymphony.xwork.validator.ActionValidatorManager
Parameters:
clazz - the class to lookup.
context - the context of the action class - can be null.
Returns:
a list of all validators for the given class and context.

validate

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

Specified by:
validate in interface com.opensymphony.xwork.validator.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,
                     com.opensymphony.xwork.validator.ValidatorContext validatorContext)
              throws com.opensymphony.xwork.validator.ValidationException
Validates an action give its context and a validation context.

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

buildValidatorKey

protected static 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.

buildClassValidatorConfigs

protected List<com.opensymphony.xwork.validator.ValidatorConfig> buildClassValidatorConfigs(Class aClass,
                                                                                            boolean checkFile)

XWork Project Page