org.hibernate.validator.metadata
Class ConstraintHelper

java.lang.Object
  extended by org.hibernate.validator.metadata.ConstraintHelper

public class ConstraintHelper
extends Object

Keeps track of builtin constraints and their validator implementations, as well as already resolved validator definitions.

Author:
Hardy Ferentschik, Alaa Nassef

Constructor Summary
ConstraintHelper()
           
 
Method Summary
<A extends Annotation>
void
addConstraintValidatorDefinition(Class<A> annotationClass, List<Class<? extends ConstraintValidator<? extends Annotation,?>>> definitionClasses)
           
 boolean containsConstraintValidatorDefinition(Class<? extends Annotation> annotationClass)
           
 List<Class<? extends ConstraintValidator<? extends Annotation,?>>> getBuiltInConstraints(Class<? extends Annotation> annotationClass)
           
<T extends Annotation>
List<Class<? extends ConstraintValidator<T,?>>>
getConstraintValidatorDefinition(Class<T> annotationClass)
           
<A extends Annotation>
List<Annotation>
getMultiValueConstraints(A annotation)
          Checks whether a given annotation is a multi value constraint and returns the contained constraints if so.
 boolean isBuiltinConstraint(Class<? extends Annotation> annotationType)
           
 boolean isConstraintAnnotation(Class<? extends Annotation> annotationType)
          Checks whether the specified annotation is a valid constraint annotation.
 boolean isConstraintComposition(Class<? extends Annotation> annotationType)
           
 boolean isMultiValueConstraint(Class<? extends Annotation> annotationType)
          Checks whether a given annotation is a multi value constraint or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConstraintHelper

public ConstraintHelper()
Method Detail

getBuiltInConstraints

public List<Class<? extends ConstraintValidator<? extends Annotation,?>>> getBuiltInConstraints(Class<? extends Annotation> annotationClass)

isBuiltinConstraint

public boolean isBuiltinConstraint(Class<? extends Annotation> annotationType)

isMultiValueConstraint

public boolean isMultiValueConstraint(Class<? extends Annotation> annotationType)
Checks whether a given annotation is a multi value constraint or not.

Parameters:
annotationType - the annotation type to check.
Returns:
true if the specified annotation is a multi value constraints, false otherwise.

getMultiValueConstraints

public <A extends Annotation> List<Annotation> getMultiValueConstraints(A annotation)
Checks whether a given annotation is a multi value constraint and returns the contained constraints if so.

Parameters:
annotation - the annotation to check.
Returns:
A list of constraint annotations or the empty list if annotation is not a multi constraint annotation.

isConstraintAnnotation

public boolean isConstraintAnnotation(Class<? extends Annotation> annotationType)
Checks whether the specified annotation is a valid constraint annotation. A constraint annotations has to fulfill the following conditions:

Parameters:
annotationType - The annotation type to test.
Returns:
true if the annotation fulfills the above condtions, false otherwise.

getConstraintValidatorDefinition

public <T extends Annotation> List<Class<? extends ConstraintValidator<T,?>>> getConstraintValidatorDefinition(Class<T> annotationClass)

addConstraintValidatorDefinition

public <A extends Annotation> void addConstraintValidatorDefinition(Class<A> annotationClass,
                                                                    List<Class<? extends ConstraintValidator<? extends Annotation,?>>> definitionClasses)

containsConstraintValidatorDefinition

public boolean containsConstraintValidatorDefinition(Class<? extends Annotation> annotationClass)

isConstraintComposition

public boolean isConstraintComposition(Class<? extends Annotation> annotationType)


Copyright © 2007-2011 Red Hat Middleware, LLC. All Rights Reserved