org.springframework.jee.validation
Class ReflectiveRuleBasedValidationService

java.lang.Object
  extended by org.springframework.jee.validation.ReflectiveRuleBasedValidationService
All Implemented Interfaces:
ValidationService

public class ReflectiveRuleBasedValidationService
extends java.lang.Object
implements ValidationService

Implementation of ValidationService that reflectively invokes annotated rule methods.

The signature of a valid validator method looks as follows:

Author:
Rod Johnson

Constructor Summary
ReflectiveRuleBasedValidationService()
           
 
Method Summary
 int addPotentialValidator(java.lang.Object instance)
          Add an instance of a class that may be a validator, caching validation methods.
protected  void invokeValidationMethods(Jsr250Metadata component, InvalidDeploymentUnitException idum)
          Reflectively invoke all the validation methods on the given component
 int validate(DeploymentUnitMetadata dum)
          Validate the given deployment
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReflectiveRuleBasedValidationService

public ReflectiveRuleBasedValidationService()
Method Detail

addPotentialValidator

public int addPotentialValidator(java.lang.Object instance)
Add an instance of a class that may be a validator, caching validation methods.

Parameters:
instance - instance of a class that may be a validator. It is not an error if the class contains no validation methods.
Returns:
the number of validation methods found

validate

public int validate(DeploymentUnitMetadata dum)
             throws InvalidDeploymentUnitException
Validate the given deployment

Specified by:
validate in interface ValidationService
Parameters:
dum - metadata for deployment unit to validate
Returns:
the number of components validated
Throws:
InvalidDeploymentUnitException - if there are errors

invokeValidationMethods

protected void invokeValidationMethods(Jsr250Metadata component,
                                       InvalidDeploymentUnitException idum)
Reflectively invoke all the validation methods on the given component

Parameters:
component - component we have metadata for
idum - exception for whole deployment unit, allowing us to add further errors


Copyright 2006 Interface21. All Rights Reserved.