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

java.lang.Object
  extended by org.hibernate.validator.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, AnnotationIgnores annotationIgnores, BeanMetaDataCache beanMetaDataCache)
           
BeanMetaDataImpl(java.lang.Class<T> beanClass, ConstraintHelper constraintHelper, BeanMetaDataCache beanMetaDataCache)
           
 
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.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()
           
 java.util.List<MetaConstraint<T,? extends java.lang.annotation.Annotation>> getMetaConstraintsAsList()
           
 java.util.Map<java.lang.Class<?>,java.util.List<MetaConstraint<T,? extends java.lang.annotation.Annotation>>> getMetaConstraintsAsMap()
           
 javax.validation.metadata.PropertyDescriptor getPropertyDescriptor(java.lang.String property)
          Return PropertyDescriptor for the given property.
 boolean isPropertyPresent(java.lang.String name)
          return true if the property exists on the object even if the property does not host any constraint nor is cascaded
 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,
                        BeanMetaDataCache beanMetaDataCache)

BeanMetaDataImpl

public BeanMetaDataImpl(java.lang.Class<T> beanClass,
                        ConstraintHelper constraintHelper,
                        AnnotationIgnores annotationIgnores,
                        BeanMetaDataCache beanMetaDataCache)
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).

getMetaConstraintsAsMap

public java.util.Map<java.lang.Class<?>,java.util.List<MetaConstraint<T,? extends java.lang.annotation.Annotation>>> getMetaConstraintsAsMap()
Specified by:
getMetaConstraintsAsMap 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.

getMetaConstraintsAsList

public java.util.List<MetaConstraint<T,? extends java.lang.annotation.Annotation>> getMetaConstraintsAsList()
Specified by:
getMetaConstraintsAsList 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.

isPropertyPresent

public boolean isPropertyPresent(java.lang.String name)
Description copied from interface: BeanMetaData
return true if the property exists on the object even if the property does not host any constraint nor is cascaded

Specified by:
isPropertyPresent in interface BeanMetaData<T>

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-2010. All Rights Reserved.