org.hibernate.validation.metadata
Class BeanMetaDataImpl<T>

java.lang.Object
  extended by org.hibernate.validation.metadata.BeanMetaDataImpl<T>
All Implemented Interfaces:
BeanMetaData<T>

public class BeanMetaDataImpl<T>
extends java.lang.Object
implements BeanMetaData<T>

This class encapsulates all meta data needed for validation. Implementations of Validator interface can instantiate an instance of this class and delegate the metadata extraction to it.

Author:
Hardy Ferentschik

Constructor Summary
BeanMetaDataImpl(java.lang.Class<T> beanClass, ConstraintHelper constraintHelper)
           
BeanMetaDataImpl(java.lang.Class<T> beanClass, ConstraintHelper constraintHelper, AnnotationIgnores annotationIgnores)
           
 
Method Summary
 void addCascadedMember(java.lang.reflect.Member member)
           
 void addMetaConstraint(java.lang.Class<?> clazz, MetaConstraint<T,? extends java.lang.annotation.Annotation> metaConstraint)
           
 boolean defaultGroupSequenceIsRedefined()
           
 java.util.List<MetaConstraint<T,? extends java.lang.annotation.Annotation>> geMetaConstraintsAsList()
           
 java.util.Map<java.lang.Class<?>,java.util.List<MetaConstraint<T,? extends java.lang.annotation.Annotation>>> geMetaConstraintsAsMap()
           
 java.lang.Class<T> getBeanClass()
           
 javax.validation.metadata.BeanDescriptor getBeanDescriptor()
           
 java.util.List<java.lang.reflect.Member> getCascadedMembers()
           
 java.util.Set<javax.validation.metadata.PropertyDescriptor> getConstrainedProperties()
           
 java.util.List<java.lang.Class<?>> getDefaultGroupSequence()
           
 javax.validation.metadata.PropertyDescriptor getPropertyDescriptor(java.lang.String property)
          Return PropertyDescriptor for the given property.
 void setDefaultGroupSequence(java.util.List<java.lang.Class<?>> groupSequence)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BeanMetaDataImpl

public BeanMetaDataImpl(java.lang.Class<T> beanClass,
                        ConstraintHelper constraintHelper)

BeanMetaDataImpl

public BeanMetaDataImpl(java.lang.Class<T> beanClass,
                        ConstraintHelper constraintHelper,
                        AnnotationIgnores annotationIgnores)
Method Detail

getBeanClass

public java.lang.Class<T> getBeanClass()
Specified by:
getBeanClass in interface BeanMetaData<T>
Returns:
the class of the bean.

getBeanDescriptor

public javax.validation.metadata.BeanDescriptor getBeanDescriptor()
Specified by:
getBeanDescriptor in interface BeanMetaData<T>
Returns:
an instance of ElementDescriptor describing the bean this meta data applies for.

getCascadedMembers

public java.util.List<java.lang.reflect.Member> getCascadedMembers()
Specified by:
getCascadedMembers in interface BeanMetaData<T>
Returns:
A list of all cascaded methods and fields (methods/fields annotated with @Valid).

geMetaConstraintsAsMap

public java.util.Map<java.lang.Class<?>,java.util.List<MetaConstraint<T,? extends java.lang.annotation.Annotation>>> geMetaConstraintsAsMap()
Specified by:
geMetaConstraintsAsMap in interface BeanMetaData<T>
Returns:
A map of MetaConstraint instances encapsulating the information of all the constraints defined on the bean mapped to the class in which the constraints is defined.

geMetaConstraintsAsList

public java.util.List<MetaConstraint<T,? extends java.lang.annotation.Annotation>> geMetaConstraintsAsList()
Specified by:
geMetaConstraintsAsList in interface BeanMetaData<T>
Returns:
A list of MetaConstraint instances encapsulating the information of all the constraints defined on the bean.

addMetaConstraint

public void addMetaConstraint(java.lang.Class<?> clazz,
                              MetaConstraint<T,? extends java.lang.annotation.Annotation> metaConstraint)

addCascadedMember

public void addCascadedMember(java.lang.reflect.Member member)

getPropertyDescriptor

public javax.validation.metadata.PropertyDescriptor getPropertyDescriptor(java.lang.String property)
Description copied from interface: BeanMetaData
Return PropertyDescriptor for the given property.

Specified by:
getPropertyDescriptor in interface BeanMetaData<T>
Parameters:
property - the property for which to retrieve the descriptor.
Returns:
Returns the PropertyDescriptor for the given property or null in case the property does not have a descriptor.

getDefaultGroupSequence

public java.util.List<java.lang.Class<?>> getDefaultGroupSequence()
Specified by:
getDefaultGroupSequence in interface BeanMetaData<T>
Returns:
A map mapping defined group sequences to a list of groups.

defaultGroupSequenceIsRedefined

public boolean defaultGroupSequenceIsRedefined()
Specified by:
defaultGroupSequenceIsRedefined in interface BeanMetaData<T>
Returns:
true if the entity redefines the default group sequence, false otherwise.

setDefaultGroupSequence

public void setDefaultGroupSequence(java.util.List<java.lang.Class<?>> groupSequence)

getConstrainedProperties

public java.util.Set<javax.validation.metadata.PropertyDescriptor> getConstrainedProperties()
Specified by:
getConstrainedProperties in interface BeanMetaData<T>
Returns:
the property descriptors having at least one constraint defined or which are marked as cascaded (@Valid).

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2007-2009. All Rights Reserved.