net.sf.jsefa.common.annotation
Class ValidatorFactory

java.lang.Object
  extended by net.sf.jsefa.common.annotation.ValidatorFactory

public final class ValidatorFactory
extends Object

Factory for creating Validators from annotated classes.

Author:
Norman Lahme-Huetig

Constructor Summary
ValidatorFactory(ValidatorProvider validatorProvider, ObjectAccessorProvider objectAccessorProvider)
          Constructs a new ValidatorFactory.
 
Method Summary
 Validator createContextualValidator(Class<?> objectType, Field field, Annotation contextAnnotation, Class<? extends Annotation> dataTypeAnnotationType)
          Creates a contextual validator for the given object type.
 Validator createValidator(Class<?> objectType, Class<? extends Annotation>... fieldAnnotationTypes)
          Creates a context free validator for the given object type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValidatorFactory

public ValidatorFactory(ValidatorProvider validatorProvider,
                        ObjectAccessorProvider objectAccessorProvider)
Constructs a new ValidatorFactory.

Parameters:
validatorProvider - the validator provider
objectAccessorProvider - the object accessor provider
Method Detail

createContextualValidator

public Validator createContextualValidator(Class<?> objectType,
                                           Field field,
                                           Annotation contextAnnotation,
                                           Class<? extends Annotation> dataTypeAnnotationType)
Creates a contextual validator for the given object type.

Parameters:
objectType - the object type to create a validator for
field - the field to create a contextual validator for (may be null)
contextAnnotation - the annotation providing parameters for constructing the validator
dataTypeAnnotationType - the type of the data type annotation providing default parameters for constructing the validator
Returns:
a validator

createValidator

public Validator createValidator(Class<?> objectType,
                                 Class<? extends Annotation>... fieldAnnotationTypes)
Creates a context free validator for the given object type.

Parameters:
objectType - the object type to create a validator for
fieldAnnotationTypes - the possible annotation types for the fields of the given object type providing parameters for constructing the validator
Returns:
a validator


Copyright © 2014. All rights reserved.