public class BeanDescriptorImpl<T> extends ElementDescriptorImpl implements BeanDescriptor, TypeDescriptor
ElementDescriptor.ConstraintFinder
Constructor and Description |
---|
BeanDescriptorImpl(Class<T> beanClass,
Set<ConstraintDescriptorImpl<?>> classLevelConstraints,
Map<String,PropertyDescriptor> properties,
Map<String,MethodDescriptor> methods,
boolean defaultGroupSequenceRedefined,
List<Class<?>> defaultGroupSequence) |
Modifier and Type | Method and Description |
---|---|
BeanDescriptor |
getBeanDescriptor()
Returns a descriptor for the bean related constraints of this type.
|
Set<MethodDescriptor> |
getConstrainedMethods()
Returns a set with the constrained methods of this type.
|
Set<PropertyDescriptor> |
getConstrainedProperties()
Returns a set of property descriptors having at least one constraint defined
or marked as cascaded (
@Valid |
MethodDescriptor |
getConstraintsForMethod(String methodName,
Class<?>... parameterTypes)
Returns a descriptor for the specified method.
|
PropertyDescriptor |
getConstraintsForProperty(String propertyName)
Return 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 cascade (@Valid )
|
boolean |
isTypeConstrained()
Whether this type has any class-, property- (field or getter style) or
method-level constraints or not.
|
asDescriptors, findConstraints, getConstraintDescriptors, getElementClass, hasConstraints, isCascaded
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
findConstraints, getConstraintDescriptors, getElementClass, hasConstraints
public BeanDescriptorImpl(Class<T> beanClass, Set<ConstraintDescriptorImpl<?>> classLevelConstraints, Map<String,PropertyDescriptor> properties, Map<String,MethodDescriptor> methods, boolean defaultGroupSequenceRedefined, List<Class<?>> defaultGroupSequence)
public final boolean isBeanConstrained()
BeanDescriptor
true
if the bean involves validation:
@Valid
)isBeanConstrained
in interface BeanDescriptor
true
if the bean involves validation, false
otherwise.public final PropertyDescriptor getConstraintsForProperty(String propertyName)
BeanDescriptor
null
if the property does not exist or has no
constraint nor is marked as cascaded (see BeanDescriptor.getConstrainedProperties()
)
The returned object (and associated objects including ConstraintDescriptor
s)
are immutable.getConstraintsForProperty
in interface BeanDescriptor
propertyName
- property evaluatedpublic final Set<PropertyDescriptor> getConstrainedProperties()
BeanDescriptor
@Valid). If not property matches,
an empty set is returned.
getConstrainedProperties
in interface BeanDescriptor
public boolean isTypeConstrained()
TypeDescriptor
Valid
annotation,Valid
annotation,Valid
annotationisTypeConstrained
in interface TypeDescriptor
True
, if this type has any constraints,
false
public Set<MethodDescriptor> getConstrainedMethods()
TypeDescriptor
getConstrainedMethods
in interface TypeDescriptor
public MethodDescriptor getConstraintsForMethod(String methodName, Class<?>... parameterTypes)
TypeDescriptor
getConstraintsForMethod
in interface TypeDescriptor
methodName
- The name of the method to retrieve a descriptor for.parameterTypes
- The types of the parameters of the method to retrieve a
descriptor for, in the order as they are defined in the method
signature.null, if no method
with the given name and parameter types is declared on the type represented
by this descriptor or its super types.
public BeanDescriptor getBeanDescriptor()
TypeDescriptor
getBeanDescriptor
in interface TypeDescriptor
Copyright © 2018 JBoss by Red Hat. All rights reserved.