org.hibernate.validator.metadata
Class MetaConstraint<T,A extends Annotation>

java.lang.Object
  extended by org.hibernate.validator.metadata.MetaConstraint<T,A>

public class MetaConstraint<T,A extends Annotation>
extends Object

Instances of this class abstract the constraint type (class, method or field constraint) and give access to meta data about the constraint. This allows a unified handling of constraints in the validator implementation.

Author:
Hardy Ferentschik

Constructor Summary
MetaConstraint(Class<T> beanClass, Member member, ConstraintDescriptorImpl<A> constraintDescriptor)
           
 
Method Summary
 Class<T> getBeanClass()
           
 ConstraintDescriptorImpl<A> getDescriptor()
           
 ElementType getElementType()
           
 Set<Class<?>> getGroupList()
           
 Member getMember()
           
 String getPropertyName()
           
 Object getValue(Object o)
           
 String toString()
           
<T,U,V> boolean
validateConstraint(ValidationContext<T> executionContext, ValueContext<U,V> valueContext)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MetaConstraint

public MetaConstraint(Class<T> beanClass,
                      Member member,
                      ConstraintDescriptorImpl<A> constraintDescriptor)
Parameters:
beanClass - The class in which the constraint is defined on
member - The member on which the constraint is defined on, null if it is a class constraint}
constraintDescriptor - The constraint descriptor for this constraint
Method Detail

getGroupList

public Set<Class<?>> getGroupList()
Returns:
Returns the list of groups this constraint is part of. This might include the default group even when it is not explicitly specified, but part of the redefined default group list of the hosting bean.

getDescriptor

public ConstraintDescriptorImpl<A> getDescriptor()

getBeanClass

public Class<T> getBeanClass()

getMember

public Member getMember()

getPropertyName

public String getPropertyName()
Returns:
The JavaBeans name of the field/property the constraint was placed on. null if this is a class level constraint.

getElementType

public ElementType getElementType()

validateConstraint

public <T,U,V> boolean validateConstraint(ValidationContext<T> executionContext,
                                          ValueContext<U,V> valueContext)

getValue

public Object getValue(Object o)
Parameters:
o - the object from which to retrieve the value.
Returns:
Returns the value for this constraint from the specified object. Depending on the type either the value itself is returned of method or field access is used to access the value.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2011 Oracle Corporation. All Rights Reserved.