net.sf.oval.configuration.annotation
Class AnnotationsConfigurer

java.lang.Object
  extended by net.sf.oval.configuration.annotation.AnnotationsConfigurer
All Implemented Interfaces:
Configurer

public class AnnotationsConfigurer
extends Object
implements Configurer

Configurer that configures constraints based on annotations tagged with Constraint

Author:
Sebastian Thomschke

Field Summary
protected  Set<CheckInitializationListener> listeners
           
 
Constructor Summary
AnnotationsConfigurer()
           
 
Method Summary
 boolean addCheckInitializationListener(CheckInitializationListener listener)
           
protected  void configureConstructorParameterChecks(ClassConfiguration classCfg)
           
protected  void configureFieldChecks(ClassConfiguration classCfg)
           
protected  void configureMethodChecks(ClassConfiguration classCfg)
          configure method return value and parameter checks
protected  void configureObjectLevelChecks(ClassConfiguration classCfg)
           
 ClassConfiguration getClassConfiguration(Class<?> clazz)
          Returns the constraint configurations for the given class.
 ConstraintSetConfiguration getConstraintSetConfiguration(String constraintSetId)
          Returns the constraint configuration for the constraint set with the given Id.
protected
<ConstraintAnnotation extends Annotation>
AnnotationCheck<ConstraintAnnotation>
initializeCheck(ConstraintAnnotation constraintAnnotation)
           
protected
<ConstraintsAnnotation extends Annotation>
void
initializeChecks(ConstraintsAnnotation constraintsAnnotation, List<Check> checks)
          handles list of annotations like @Assert.List(...)
protected
<ExclusionAnnotation extends Annotation>
AnnotationCheckExclusion<ExclusionAnnotation>
initializeExclusion(ExclusionAnnotation exclusionAnnotation)
           
protected
<ConstraintAnnotation extends Annotation>
AnnotationCheck<ConstraintAnnotation>
newCheckInstance(Class<AnnotationCheck<ConstraintAnnotation>> checkClass)
           
 boolean removeCheckInitializationListener(CheckInitializationListener listener)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listeners

protected final Set<CheckInitializationListener> listeners
Constructor Detail

AnnotationsConfigurer

public AnnotationsConfigurer()
Method Detail

addCheckInitializationListener

public boolean addCheckInitializationListener(CheckInitializationListener listener)

configureConstructorParameterChecks

protected void configureConstructorParameterChecks(ClassConfiguration classCfg)

configureFieldChecks

protected void configureFieldChecks(ClassConfiguration classCfg)

configureMethodChecks

protected void configureMethodChecks(ClassConfiguration classCfg)
configure method return value and parameter checks


configureObjectLevelChecks

protected void configureObjectLevelChecks(ClassConfiguration classCfg)

getClassConfiguration

public ClassConfiguration getClassConfiguration(Class<?> clazz)
Description copied from interface: Configurer
Returns the constraint configurations for the given class. This method is invoked only once by the Validator, the very first time an object of the given class needs to be validated. The constraint configuration is then translated into an Validator internal format and cached.

Specified by:
getClassConfiguration in interface Configurer
Parameters:
clazz - the class to get the configuration for
Returns:
The constraint configurations for the given class.

getConstraintSetConfiguration

public ConstraintSetConfiguration getConstraintSetConfiguration(String constraintSetId)
Description copied from interface: Configurer
Returns the constraint configuration for the constraint set with the given Id.

Specified by:
getConstraintSetConfiguration in interface Configurer
Parameters:
constraintSetId - the ID of the constraint set
Returns:
The constraint configuration for the constraint set with the given Id.

initializeCheck

protected <ConstraintAnnotation extends Annotation> AnnotationCheck<ConstraintAnnotation> initializeCheck(ConstraintAnnotation constraintAnnotation)
                                                                            throws ReflectionException
Throws:
ReflectionException

initializeChecks

protected <ConstraintsAnnotation extends Annotation> void initializeChecks(ConstraintsAnnotation constraintsAnnotation,
                                                                           List<Check> checks)
                         throws ReflectionException
handles list of annotations like @Assert.List(...)

Throws:
ReflectionException

initializeExclusion

protected <ExclusionAnnotation extends Annotation> AnnotationCheckExclusion<ExclusionAnnotation> initializeExclusion(ExclusionAnnotation exclusionAnnotation)
                                                                                        throws ReflectionException
Throws:
ReflectionException

newCheckInstance

protected <ConstraintAnnotation extends Annotation> AnnotationCheck<ConstraintAnnotation> newCheckInstance(Class<AnnotationCheck<ConstraintAnnotation>> checkClass)
                                                                             throws OValException
Returns:
a new instance of the given constraint check implementation class
Throws:
OValException

removeCheckInitializationListener

public boolean removeCheckInitializationListener(CheckInitializationListener listener)


Copyright © 2005–2015 The OVal Development Team. All rights reserved.