Class AnnotationMetaDataProvider
java.lang.Object
org.hibernate.validator.internal.metadata.provider.AnnotationMetaDataProvider
- All Implemented Interfaces:
MetaDataProvider
MetaDataProvider
which reads the metadata from annotations which is the default configuration source.- Author:
- Gunnar Morling, Hardy Ferentschik, Guillaume Smet
-
Constructor Summary
ConstructorDescriptionAnnotationMetaDataProvider
(ConstraintCreationContext constraintCreationContext, JavaBeanHelper javaBeanHelper, AnnotationProcessingOptions annotationProcessingOptions) -
Method Summary
Modifier and TypeMethodDescriptionprotected <A extends Annotation>
List<ConstraintDescriptorImpl<?>>findConstraintAnnotations
(Constrainable constrainable, A annotation, ConstraintLocation.ConstraintLocationKind type) Examines the given annotation to see whether it is a single- or multi-valued constraint annotation.protected Set<MetaConstraint<?>>
findTypeAnnotationConstraints
(JavaBeanExecutable<?> javaBeanExecutable) Finds type arguments constraints for method return values.protected Set<MetaConstraint<?>>
findTypeAnnotationConstraints
(JavaBeanField javaBeanField) Finds type arguments constraints for fields.protected Set<MetaConstraint<?>>
findTypeAnnotationConstraintsForExecutableParameter
(JavaBeanExecutable<?> javaBeanExecutable, JavaBeanParameter javaBeanParameter) Finds type arguments constraints for parameters.Returns the annotation processing options as configured by this provider.<T> BeanConfiguration<T>
getBeanConfiguration
(Class<T> beanClass) Returns a bean configuration for the given type ornull
if this provider has no meta-data on the given type.
-
Constructor Details
-
AnnotationMetaDataProvider
public AnnotationMetaDataProvider(ConstraintCreationContext constraintCreationContext, JavaBeanHelper javaBeanHelper, AnnotationProcessingOptions annotationProcessingOptions)
-
-
Method Details
-
getAnnotationProcessingOptions
Description copied from interface:MetaDataProvider
Returns the annotation processing options as configured by this provider.- Specified by:
getAnnotationProcessingOptions
in interfaceMetaDataProvider
- Returns:
- The annotation processing options as configured by this provider.
-
getBeanConfiguration
Description copied from interface:MetaDataProvider
Returns a bean configuration for the given type ornull
if this provider has no meta-data on the given type.- Specified by:
getBeanConfiguration
in interfaceMetaDataProvider
-
findConstraintAnnotations
protected <A extends Annotation> List<ConstraintDescriptorImpl<?>> findConstraintAnnotations(Constrainable constrainable, A annotation, ConstraintLocation.ConstraintLocationKind type) Examines the given annotation to see whether it is a single- or multi-valued constraint annotation.- Type Parameters:
A
- the annotation type- Parameters:
constrainable
- The constrainable to check for constraints annotationsannotation
- The annotation to examinetype
- the element type on which the annotation/constraint is placed on- Returns:
- A list of constraint descriptors or the empty list in case
annotation
is neither a single nor multi-valued annotation.
-
findTypeAnnotationConstraints
Finds type arguments constraints for fields. -
findTypeAnnotationConstraints
protected Set<MetaConstraint<?>> findTypeAnnotationConstraints(JavaBeanExecutable<?> javaBeanExecutable) Finds type arguments constraints for method return values. -
findTypeAnnotationConstraintsForExecutableParameter
protected Set<MetaConstraint<?>> findTypeAnnotationConstraintsForExecutableParameter(JavaBeanExecutable<?> javaBeanExecutable, JavaBeanParameter javaBeanParameter) Finds type arguments constraints for parameters.- Parameters:
javaBeanParameter
- the parameter- Returns:
- a set of type arguments constraints, or an empty set if no constrained type arguments are found
-