org.apache.bval.jsr303
Class Jsr303MetaBeanFactory

java.lang.Object
  extended by org.apache.bval.jsr303.Jsr303MetaBeanFactory
All Implemented Interfaces:
MetaBeanFactory
Direct Known Subclasses:
MethodValidatorMetaBeanFactory

public class Jsr303MetaBeanFactory
extends Object
implements MetaBeanFactory

Description: process the class annotations for JSR303 constraint validations to build the MetaBean with information from annotations and JSR303 constraint mappings (defined in xml)


Field Summary
static String ANNOTATION_GROUPS
           
static String ANNOTATION_MESSAGE
           
static String ANNOTATION_PAYLOAD
           
protected static String ANNOTATION_VALUE
          Constant for the "value" annotation attribute specified in JSR303
protected  ApacheFactoryContext factoryContext
          ApacheFactoryContext used
protected static org.slf4j.Logger log
          Shared log instance
 
Constructor Summary
Jsr303MetaBeanFactory(ApacheFactoryContext factoryContext)
          Create a new Jsr303MetaBeanFactory instance.
 
Method Summary
protected
<A extends Annotation>
boolean
applyConstraint(A annotation, Class<? extends ConstraintValidator<A,?>>[] constraintClasses, MetaProperty prop, Class<?> owner, AccessStrategy access, AppendValidation appender)
          Apply a constraint to the specified appender.
 void buildMetaBean(MetaBean metabean)
           Add the validation features to the metabean that come from JSR303 annotations in the beanClass.
protected
<A extends Annotation>
Class<? extends ConstraintValidator<A,?>>[]
findConstraintValidatorClasses(A annotation, Constraint vcAnno)
          Find available ConstraintValidation classes for a given constraint annotation.
protected  boolean hasValidationConstraintsDefined(Method method)
          Learn whether a given Method has validation constraints defined via JSR303 annotations.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.slf4j.Logger log
Shared log instance


ANNOTATION_VALUE

protected static final String ANNOTATION_VALUE
Constant for the "value" annotation attribute specified in JSR303

See Also:
Constant Field Values

ANNOTATION_PAYLOAD

public static final String ANNOTATION_PAYLOAD
See Also:
Constant Field Values

ANNOTATION_GROUPS

public static final String ANNOTATION_GROUPS
See Also:
Constant Field Values

ANNOTATION_MESSAGE

public static final String ANNOTATION_MESSAGE
See Also:
Constant Field Values

factoryContext

protected final ApacheFactoryContext factoryContext
ApacheFactoryContext used

Constructor Detail

Jsr303MetaBeanFactory

public Jsr303MetaBeanFactory(ApacheFactoryContext factoryContext)
Create a new Jsr303MetaBeanFactory instance.

Parameters:
factoryContext -
Method Detail

buildMetaBean

public void buildMetaBean(MetaBean metabean)
Add the validation features to the metabean that come from JSR303 annotations in the beanClass.

Specified by:
buildMetaBean in interface MetaBeanFactory

hasValidationConstraintsDefined

protected boolean hasValidationConstraintsDefined(Method method)
Learn whether a given Method has validation constraints defined via JSR303 annotations.

Parameters:
method -
Returns:
true if constraints detected

findConstraintValidatorClasses

protected <A extends Annotation> Class<? extends ConstraintValidator<A,?>>[] findConstraintValidatorClasses(A annotation,
                                                                                                            Constraint vcAnno)
Find available ConstraintValidation classes for a given constraint annotation.

Parameters:
annotation -
vcAnno -
Returns:
ConstraintValidation implementation class array

applyConstraint

protected <A extends Annotation> boolean applyConstraint(A annotation,
                                                         Class<? extends ConstraintValidator<A,?>>[] constraintClasses,
                                                         MetaProperty prop,
                                                         Class<?> owner,
                                                         AccessStrategy access,
                                                         AppendValidation appender)
                           throws IllegalAccessException,
                                  InvocationTargetException
Apply a constraint to the specified appender.

Parameters:
annotation - constraint annotation
constraintClasses - known ConstraintValidator implementation classes for annotation
prop - meta-property
owner - type
access - strategy
appender -
Returns:
success flag
Throws:
IllegalAccessException
InvocationTargetException


Copyright © 2010-2011 The Apache Software Foundation. All Rights Reserved.