org.hibernate.validator.metadata
Class ConstraintHelper

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

public class ConstraintHelper
extends java.lang.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 java.lang.annotation.Annotation>
void
addConstraintValidatorDefinition(java.lang.Class<A> annotationClass, java.util.List<java.lang.Class<? extends javax.validation.ConstraintValidator<? extends java.lang.annotation.Annotation,?>>> definitionClasses)
           
 boolean containsConstraintValidatorDefinition(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
           
 java.util.List<java.lang.Class<? extends javax.validation.ConstraintValidator<? extends java.lang.annotation.Annotation,?>>> getBuiltInConstraints(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
           
<T extends java.lang.annotation.Annotation>
java.util.List<java.lang.Class<? extends javax.validation.ConstraintValidator<T,?>>>
getConstraintValidatorDefinition(java.lang.Class<T> annotationClass)
           
<A extends java.lang.annotation.Annotation>
java.util.List<java.lang.annotation.Annotation>
getMultiValueConstraints(A annotation)
          Checks whether a given annotation is a multi value constraint and returns the contained constraints if so.
 boolean isBuiltinConstraint(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
           
 boolean isConstraintAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
          Checks whether the specified annotation is a valid constraint annotation.
 boolean isConstraintComposition(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
           
 boolean isMultiValueConstraint(java.lang.Class<? extends java.lang.annotation.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 java.util.List<java.lang.Class<? extends javax.validation.ConstraintValidator<? extends java.lang.annotation.Annotation,?>>> getBuiltInConstraints(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)

isBuiltinConstraint

public boolean isBuiltinConstraint(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)

isMultiValueConstraint

public boolean isMultiValueConstraint(java.lang.Class<? extends java.lang.annotation.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 java.lang.annotation.Annotation> java.util.List<java.lang.annotation.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(java.lang.Class<? extends java.lang.annotation.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 java.lang.annotation.Annotation> java.util.List<java.lang.Class<? extends javax.validation.ConstraintValidator<T,?>>> getConstraintValidatorDefinition(java.lang.Class<T> annotationClass)

addConstraintValidatorDefinition

public <A extends java.lang.annotation.Annotation> void addConstraintValidatorDefinition(java.lang.Class<A> annotationClass,
                                                                                         java.util.List<java.lang.Class<? extends javax.validation.ConstraintValidator<? extends java.lang.annotation.Annotation,?>>> definitionClasses)

containsConstraintValidatorDefinition

public boolean containsConstraintValidatorDefinition(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)

isConstraintComposition

public boolean isConstraintComposition(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)


Copyright © 2011 Oracle Corporation. All Rights Reserved.