org.hibernate.validator.internal.metadata.core
Class MetaConstraint<A extends Annotation>

java.lang.Object
  extended by org.hibernate.validator.internal.metadata.core.MetaConstraint<A>

public class MetaConstraint<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, Gunnar Morling

Constructor Summary
MetaConstraint(ConstraintDescriptorImpl<A> constraintDescriptor, ConstraintLocation location)
           
 
Method Summary
 boolean equals(Object o)
           
 ConstraintDescriptorImpl<A> getDescriptor()
           
 ElementType getElementType()
           
 Set<Class<?>> getGroupList()
           
 ConstraintLocation getLocation()
           
 Object getValue(Object o)
           
 int hashCode()
           
 String toString()
           
protected  Type typeOfAnnotatedElement()
           
 boolean validateConstraint(ValidationContext<?,?> executionContext, ValueContext<?,?> valueContext)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MetaConstraint

public MetaConstraint(ConstraintDescriptorImpl<A> constraintDescriptor,
                      ConstraintLocation location)
Parameters:
constraintDescriptor - The constraint descriptor for this constraint
location - meta data about constraint placement
Method Detail

getGroupList

public final 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 final ConstraintDescriptorImpl<A> getDescriptor()

getElementType

public final ElementType getElementType()

validateConstraint

public boolean validateConstraint(ValidationContext<?,?> executionContext,
                                  ValueContext<?,?> valueContext)

getLocation

public ConstraintLocation getLocation()

typeOfAnnotatedElement

protected final Type typeOfAnnotatedElement()

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.

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2012 Oracle Corporation. All Rights Reserved.