public class BeanDescriptorImpl extends ElementDescriptorImpl implements BeanDescriptor
ElementDescriptor.ConstraintFinder
Constructor and Description |
---|
BeanDescriptorImpl(Type beanClass,
Set<ConstraintDescriptorImpl<?>> classLevelConstraints,
Map<String,PropertyDescriptor> constrainedProperties,
Map<String,ExecutableDescriptorImpl> constrainedMethods,
Map<String,ConstructorDescriptor> constrainedConstructors,
boolean defaultGroupSequenceRedefined,
List<Class<?>> defaultGroupSequence) |
Modifier and Type | Method and Description |
---|---|
Set<ConstructorDescriptor> |
getConstrainedConstructors()
Returns a set with descriptors for the constrained constructors of the
bean represented by this descriptor.
|
Set<MethodDescriptor> |
getConstrainedMethods(MethodType methodType,
MethodType... methodTypes)
Returns a set with descriptors for the constrained methods of the bean
represented by this descriptor.
|
Set<PropertyDescriptor> |
getConstrainedProperties()
Returns a set of property descriptors having at least one constraint defined
or marked as cascaded (
Valid ). |
ConstructorDescriptor |
getConstraintsForConstructor(Class<?>... parameterTypes)
Returns a constructor descriptor for the given constructor.
|
MethodDescriptor |
getConstraintsForMethod(String methodName,
Class<?>... parameterTypes)
Returns a method descriptor for the given method.
|
PropertyDescriptor |
getConstraintsForProperty(String propertyName)
Returns the property descriptor for a given property.
|
boolean |
isBeanConstrained()
Returns
true if 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 )
|
String |
toString() |
findConstraints, getConstraintDescriptors, getElementClass, hasConstraints
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
findConstraints, getConstraintDescriptors, getElementClass, hasConstraints
public BeanDescriptorImpl(Type beanClass, Set<ConstraintDescriptorImpl<?>> classLevelConstraints, Map<String,PropertyDescriptor> constrainedProperties, Map<String,ExecutableDescriptorImpl> constrainedMethods, Map<String,ConstructorDescriptor> constrainedConstructors, boolean defaultGroupSequenceRedefined, List<Class<?>> defaultGroupSequence)
public final boolean isBeanConstrained()
BeanDescriptor
true
if the bean involves validation:
Valid
)Constrained methods and constructors are ignored.
isBeanConstrained
in interface BeanDescriptor
true
if the bean involves validation, false
otherwisepublic final PropertyDescriptor getConstraintsForProperty(String propertyName)
BeanDescriptor
Returns null
if the property does not exist or has no
constraint nor is marked as cascaded (see BeanDescriptor.getConstrainedProperties()
)
Properties of super types are considered.
getConstraintsForProperty
in interface BeanDescriptor
propertyName
- property evaluatedpublic final Set<PropertyDescriptor> getConstrainedProperties()
BeanDescriptor
Valid
).
If no property matches, an empty set is returned. Properties of super types are considered.
getConstrainedProperties
in interface BeanDescriptor
PropertyDescriptor
s for the constraint properties; if
there are no constraint properties, the empty set is returnedpublic ConstructorDescriptor getConstraintsForConstructor(Class<?>... parameterTypes)
BeanDescriptor
Returns null
if 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.
getConstraintsForConstructor
in interface BeanDescriptor
parameterTypes
- the parameter types of the constructorpublic Set<ConstructorDescriptor> getConstrainedConstructors()
BeanDescriptor
Constrained constructors have at least one parameter or return value constraint or at least one parameter or return value marked for cascaded validation.
getConstrainedConstructors
in interface BeanDescriptor
null
public Set<MethodDescriptor> getConstrainedMethods(MethodType methodType, MethodType... methodTypes)
BeanDescriptor
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.
getConstrainedMethods
in interface BeanDescriptor
methodType
- method type to considermethodTypes
- remaining optional method types to considernull
public MethodDescriptor getConstraintsForMethod(String methodName, Class<?>... parameterTypes)
BeanDescriptor
Returns null
if 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.
getConstraintsForMethod
in interface BeanDescriptor
methodName
- the name of the methodparameterTypes
- the parameter types of the methodCopyright © 2021 JBoss by Red Hat. All rights reserved.