org.hibernate.validator.metadata
Interface BeanMetaData<T>

All Known Implementing Classes:
BeanMetaDataImpl

public interface BeanMetaData<T>

Interface defining the meta data about the constraints defined in a given bean.

Author:
Hardy Ferentschik, Gunnar Morling

Method Summary
 boolean defaultGroupSequenceIsRedefined()
           
 Set<AggregatedMethodMetaData> getAllMethodMetaData()
          Returns the constraint-related meta data for all the methods of the type represented by this bean meta data.
 Class<T> getBeanClass()
           
 BeanDescriptor getBeanDescriptor()
           
 Set<Member> getCascadedMembers()
           
 List<Class<?>> getClassHierarchy()
           
 Set<PropertyDescriptor> getConstrainedProperties()
           
 List<Class<?>> getDefaultGroupSequence(T beanState)
          Get the composition of the default group sequence.
 Set<BeanMetaConstraint<?>> getDirectMetaConstraints()
           
 Set<BeanMetaConstraint<?>> getMetaConstraints()
           
 AggregatedMethodMetaData getMetaDataFor(Method method)
          Returns the constraint-related meta data for the given method of the class represented by this bean meta data.
 PropertyDescriptor getPropertyDescriptor(String property)
          Return PropertyDescriptor for the given property.
 TypeDescriptor getTypeDescriptor()
           
 boolean isPropertyPresent(String name)
           
 

Method Detail

getBeanClass

Class<T> getBeanClass()
Returns:
the class of the bean.

getBeanDescriptor

BeanDescriptor getBeanDescriptor()
Returns:
an instance of ElementDescriptor describing the bean this meta data applies for.

getTypeDescriptor

TypeDescriptor getTypeDescriptor()
Returns:
An instance of TypeDescriptor describing the bean this meta data applies for.

getCascadedMembers

Set<Member> getCascadedMembers()
Returns:
A list of all cascaded methods and fields (methods/fields annotated with @Valid).

getDefaultGroupSequence

List<Class<?>> getDefaultGroupSequence(T beanState)
Get the composition of the default group sequence.

If the bean state is given in parameter and the bean metadata has a default group sequence provider then the dynamic default group sequence composition is returned. In the other cases the default group sequence redefinition specified by BV is used.

Parameters:
beanState - the bean state.
Returns:
a list of classes representing the default group sequence.

defaultGroupSequenceIsRedefined

boolean defaultGroupSequenceIsRedefined()
Returns:
true if the entity redefines the default group sequence, false otherwise.

getMetaConstraints

Set<BeanMetaConstraint<?>> getMetaConstraints()
Returns:
A set of MetaConstraint instances encapsulating the information of all the constraints defined on the bean. This collection includes constraints from super classes as well

getDirectMetaConstraints

Set<BeanMetaConstraint<?>> getDirectMetaConstraints()
Returns:
A set of MetaConstraint instances encapsulating the information of all the constraints defined on the bean directly (including constraints defined on implemented interfaces). It does not contain constraints from super classes or interfaces implemented by super classes

getMetaDataFor

AggregatedMethodMetaData getMetaDataFor(Method method)
Returns the constraint-related meta data for the given method of the class represented by this bean meta data.

Parameters:
method - The method of interest.
Returns:
An aggregated view on the constraint related meta data from the given method all the methods from super-types which it overrides or implements.

getAllMethodMetaData

Set<AggregatedMethodMetaData> getAllMethodMetaData()
Returns the constraint-related meta data for all the methods of the type represented by this bean meta data.

Returns:
A set with constraint-related method meta data. May be empty, but will never be null.

getPropertyDescriptor

PropertyDescriptor getPropertyDescriptor(String property)
Return PropertyDescriptor for the given property.

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

boolean isPropertyPresent(String name)
Parameters:
name - The name of the property
Returns:
true if the property exists on the object even if the property does not host any constraint nor is cascaded

getConstrainedProperties

Set<PropertyDescriptor> getConstrainedProperties()
Returns:
the property descriptors having at least one constraint defined or which are marked as cascaded (@Valid).

getClassHierarchy

List<Class<?>> getClassHierarchy()
Returns:
Returns a list of classes representing the class hierarchy for the entity. The list start with the element itself and goes up the hierarchy chain. Interfaces are not included.


Copyright © 2007-2011 Red Hat Middleware, LLC. All Rights Reserved