Interface BeanMetaData<T>
- All Superinterfaces:
Validatable
- All Known Implementing Classes:
BeanMetaDataImpl
Interface defining the meta data about the constraints defined in a given bean.
- Author:
- Hardy Ferentschik, Gunnar Morling, Guillaume Smet
-
Method Summary
Modifier and TypeMethodDescriptiongetDefaultGroupSequence(T beanState) Get the composition of the default group sequence.getDefaultValidationSequence(T beanState) Returns an iterator over the default validation group sequence as configured through@GroupSequence/@DefaultGroupSequenceProvider.Set<MetaConstraint<?>>Set<MetaConstraint<?>>getMetaDataFor(Executable executable) Returns the constraint-related metadata for the given executable of the class represented by this bean metadata.getMetaDataFor(String propertyName) Returns constraint-related meta data for the given property of this bean.booleanReturnstrueif the bean class for this bean meta data has any constraints at all,falseotherwise.booleanMethods inherited from interface org.hibernate.validator.internal.metadata.facets.Validatable
getCascadables, hasCascadables
-
Method Details
-
getBeanClass
- Returns:
- the class of the bean.
-
hasConstraints
boolean hasConstraints()Returnstrueif the bean class for this bean meta data has any constraints at all,falseotherwise.- Returns:
trueif the bean class for this bean meta data has any constraints at all,falseotherwise.
-
getBeanDescriptor
BeanDescriptor getBeanDescriptor()- Returns:
- an instance of
ElementDescriptordescribing the bean this meta data applies for.
-
getMetaDataFor
Returns constraint-related meta data for the given property of this bean.- Parameters:
propertyName- The property name.- Returns:
- Constraint-related meta data.
- Throws:
IllegalArgumentException- In case no property with the given name exists.
-
getDefaultGroupSequence
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.
-
getDefaultValidationSequence
Returns an iterator over the default validation group sequence as configured through@GroupSequence/@DefaultGroupSequenceProvider. If this bean type does not re-declare the default validation group sequence,ValidationOrder.DEFAULT_SEQUENCEwill be returned. -
isDefaultGroupSequenceRedefined
boolean isDefaultGroupSequenceRedefined()- Returns:
trueif the entity redefines the default group sequence,falseotherwise.
-
getMetaConstraints
Set<MetaConstraint<?>> getMetaConstraints()- Returns:
- A set of
MetaConstraintinstances encapsulating the information of all the constraints defined on the bean. This collection includes constraints from super classes as well
-
getDirectMetaConstraints
Set<MetaConstraint<?>> getDirectMetaConstraints()- Returns:
- A set of
MetaConstraintinstances 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
Returns the constraint-related metadata for the given executable of the class represented by this bean metadata.- Parameters:
executable- The executable of interest.- Returns:
- An optional either containing an aggregated view on the constraint related metadata from the given method and all the methods from super-types which it overrides or implements or being empty if the method is not constrained at all.
- Throws:
IllegalArgumentException- In case the method cannot be found in the bean.
-
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.
-