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

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

public class MetaConstraint<T,A extends java.lang.annotation.Annotation>
extends java.lang.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(java.lang.Class<T> beanClass, java.lang.reflect.Member member, ConstraintDescriptorImpl<A> constraintDescriptor)
           
 
Method Summary
 java.lang.Class<T> getBeanClass()
           
 ConstraintDescriptorImpl<A> getDescriptor()
           
 java.lang.annotation.ElementType getElementType()
           
 java.util.Set<java.lang.Class<?>> getGroupList()
           
 java.lang.reflect.Member getMember()
           
 java.lang.String getPropertyName()
           
 java.lang.Object getValue(java.lang.Object o)
           
 java.lang.String toString()
           
<T,U,V> boolean
validateConstraint(GlobalExecutionContext<T> executionContext, LocalExecutionContext<U,V> localExecutionContext)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MetaConstraint

public MetaConstraint(java.lang.Class<T> beanClass,
                      java.lang.reflect.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 java.util.Set<java.lang.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 java.lang.Class<T> getBeanClass()

getMember

public java.lang.reflect.Member getMember()

getPropertyName

public java.lang.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 java.lang.annotation.ElementType getElementType()

validateConstraint

public <T,U,V> boolean validateConstraint(GlobalExecutionContext<T> executionContext,
                                          LocalExecutionContext<U,V> localExecutionContext)

getValue

public java.lang.Object getValue(java.lang.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 java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2007-2010. All Rights Reserved.