-
- All Superinterfaces:
- ElementDescriptor
public interface BeanDescriptor extends ElementDescriptor
Describes a constrained Java Bean and the constraints associated to it. All objects returned by the methods of this descriptor (and associated objects includingConstraintDescriptor
s) are immutable.- Author:
- Emmanuel Bernard, Gunnar Morling
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface javax.validation.metadata.ElementDescriptor
ElementDescriptor.ConstraintFinder
-
-
Method Summary
All Methods Instance Methods Abstract Methods 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()
Returnstrue
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
) Constrained methods and constructors are ignored.-
Methods inherited from interface javax.validation.metadata.ElementDescriptor
findConstraints, getConstraintDescriptors, getElementClass, hasConstraints
-
-
-
-
Method Detail
-
isBeanConstrained
boolean isBeanConstrained()
Returnstrue
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
)
- Returns:
true
if the bean involves validation,false
otherwise
-
getConstraintsForProperty
PropertyDescriptor getConstraintsForProperty(String propertyName)
Returns the property descriptor for a given property. Returnsnull
if the property does not exist or has no constraint nor is marked as cascaded (seegetConstrainedProperties()
) Properties of super types are considered.- Parameters:
propertyName
- property evaluated- Returns:
- the property descriptor for a given property
- Throws:
IllegalArgumentException
- ifpropertyName
isnull
-
getConstrainedProperties
Set<PropertyDescriptor> getConstrainedProperties()
Returns a set of property descriptors having at least one constraint defined or marked as cascaded (Valid
). If not property matches, an empty set is returned. Properties of super types are considered.- Returns:
- the set of
PropertyDescriptor
s for the constraint properties; if there are no constraint properties, the empty set is returned
-
getConstraintsForMethod
MethodDescriptor getConstraintsForMethod(String methodName, Class<?>... parameterTypes)
Returns a method descriptor for the given method. Returnsnull
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.- Parameters:
methodName
- the name of the methodparameterTypes
- the parameter types of the method- Returns:
- a method descriptor for the given method
- Throws:
IllegalArgumentException
- ifmethodName
isnull
- Since:
- 1.1
-
getConstrainedMethods
Set<MethodDescriptor> getConstrainedMethods(MethodType methodType, MethodType... methodTypes)
Returns 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.- 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
- Since:
- 1.1
-
getConstraintsForConstructor
ConstructorDescriptor getConstraintsForConstructor(Class<?>... parameterTypes)
Returns a constructor descriptor for the given constructor. Returnsnull
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. Constructor of super types are considered.- Parameters:
parameterTypes
- the parameter types of the constructor- Returns:
- a constructor descriptor for the given constructor
- Since:
- 1.1
-
getConstrainedConstructors
Set<ConstructorDescriptor> getConstrainedConstructors()
Returns 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.- Returns:
- a set with descriptors for the constrained constructor of this
bean; will be empty if this bea has no constrained constructor
but never
null
- Since:
- 1.1
-
-
Deutsche Übersetzung
Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.
Vielen Dank im Voraus.
Dokument erstellt 11/06/2005, zuletzt geändert 18/08/2025
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/java-api-javaee-rf-javax/validation/metadata/BeanDescriptor.html
Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.
Referenzen
Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor dieser Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.