Class BeanDescriptorImpl
- All Implemented Interfaces:
BeanDescriptor,ElementDescriptor,Serializable
- Author:
- Emmanuel Bernard, Hardy Ferentschik, Gunnar Morling
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface jakarta.validation.metadata.ElementDescriptor
ElementDescriptor.ConstraintFinder -
Constructor Summary
ConstructorsConstructorDescriptionBeanDescriptorImpl(Type beanClass, Set<ConstraintDescriptorImpl<?>> classLevelConstraints, Map<String, PropertyDescriptor> constrainedProperties, Map<Signature, ExecutableDescriptorImpl> constrainedMethods, Map<Signature, ConstructorDescriptor> constrainedConstructors, boolean defaultGroupSequenceRedefined, List<Class<?>> defaultGroupSequence) -
Method Summary
Modifier and TypeMethodDescriptionReturns a set with descriptors for the constrained constructors of the bean represented by this descriptor.getConstrainedMethods(MethodType methodType, MethodType... methodTypes) Returns a set with descriptors for the constrained methods of the bean represented by this descriptor.final Set<PropertyDescriptor>Returns a set of property descriptors having at least one constraint defined or marked as cascaded (Valid).getConstraintsForConstructor(Class<?>... parameterTypes) Returns a constructor descriptor for the given constructor.getConstraintsForMethod(String methodName, Class<?>... parameterTypes) Returns a method descriptor for the given method.final PropertyDescriptorgetConstraintsForProperty(String propertyName) Returns the property descriptor for a given property.final booleanReturnstrueif the bean involves validation: a constraint is hosted on the bean itself a constraint is hosted on one of the bean properties or a bean property is marked for cascaded validation (Valid)toString()Methods inherited from class org.hibernate.validator.internal.metadata.descriptor.ElementDescriptorImpl
findConstraints, getConstraintDescriptors, getElementClass, hasConstraintsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface jakarta.validation.metadata.ElementDescriptor
findConstraints, getConstraintDescriptors, getElementClass, hasConstraints
-
Constructor Details
-
BeanDescriptorImpl
public BeanDescriptorImpl(Type beanClass, Set<ConstraintDescriptorImpl<?>> classLevelConstraints, Map<String, PropertyDescriptor> constrainedProperties, Map<Signature, ExecutableDescriptorImpl> constrainedMethods, Map<Signature, ConstructorDescriptor> constrainedConstructors, boolean defaultGroupSequenceRedefined, List<Class<?>> defaultGroupSequence)
-
-
Method Details
-
isBeanConstrained
public final boolean isBeanConstrained()Description copied from interface:BeanDescriptorReturnstrueif the bean involves validation:- a constraint is hosted on the bean itself
- a constraint is hosted on one of the bean properties
- or a bean property is marked for cascaded validation (
Valid)
Constrained methods and constructors are ignored.
- Specified by:
isBeanConstrainedin interfaceBeanDescriptor- Returns:
trueif the bean involves validation,falseotherwise
-
getConstraintsForProperty
Description copied from interface:BeanDescriptorReturns the property descriptor for a given property.Returns
nullif the property does not exist or has no constraint nor is marked as cascaded (seeBeanDescriptor.getConstrainedProperties()) Properties of super types are considered.- Specified by:
getConstraintsForPropertyin interfaceBeanDescriptor- Parameters:
propertyName- property evaluated- Returns:
- the property descriptor for a given property
-
getConstrainedProperties
Description copied from interface:BeanDescriptorReturns a set of property descriptors having at least one constraint defined or marked as cascaded (Valid).If no property matches, an empty set is returned. Properties of super types are considered.
- Specified by:
getConstrainedPropertiesin interfaceBeanDescriptor- Returns:
- the set of
PropertyDescriptors for the constraint properties; if there are no constraint properties, the empty set is returned
-
getConstraintsForConstructor
Description copied from interface:BeanDescriptorReturns a constructor descriptor for the given constructor.Returns
nullif no constructor with the given parameter types exists or the specified constructor neither has parameter or return value constraints nor a parameter or return value marked for cascaded validation.- Specified by:
getConstraintsForConstructorin interfaceBeanDescriptor- Parameters:
parameterTypes- the parameter types of the constructor- Returns:
- a constructor descriptor for the given constructor
-
getConstrainedConstructors
Description copied from interface:BeanDescriptorReturns a set with descriptors for the constrained constructors of the bean represented by this descriptor.Constrained constructors have at least one parameter or return value constraint or at least one parameter or return value marked for cascaded validation.
- Specified by:
getConstrainedConstructorsin interfaceBeanDescriptor- Returns:
- a set with descriptors for the constrained constructor of this
bean; will be empty if this bean has no constrained constructor
but never
null
-
getConstrainedMethods
public Set<MethodDescriptor> getConstrainedMethods(MethodType methodType, MethodType... methodTypes) Description copied from interface:BeanDescriptorReturns a set with descriptors for the constrained methods of the bean represented by this descriptor.Constrained methods have at least one parameter or return value constraint or at least one parameter or return value marked for cascaded validation. Methods of super types are considered.
Only methods matching the given method type(s) are considered.
- Specified by:
getConstrainedMethodsin interfaceBeanDescriptor- Parameters:
methodType- method type to considermethodTypes- remaining optional method types to consider- Returns:
- a set with descriptors for the constrained methods of this bean;
will be empty if this bean has no constrained methods of the considered
method type(s) but never
null
-
getConstraintsForMethod
Description copied from interface:BeanDescriptorReturns a method descriptor for the given method.Returns
nullif no method with the given name and parameter types exists or the specified method neither has parameter or return value constraints nor a parameter or return value marked for cascaded validation. Methods of super types are considered.- Specified by:
getConstraintsForMethodin interfaceBeanDescriptor- Parameters:
methodName- the name of the methodparameterTypes- the parameter types of the method- Returns:
- a method descriptor for the given method
-
toString
-