javax.validation.metadata

Interface BeanDescriptor

  • 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 including ConstraintDescriptors) are immutable.
    Author:
    Emmanuel Bernard, Gunnar Morling
    • Method Detail

      • isBeanConstrained

        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)

        Constrained methods and constructors are ignored.

        Returns:
        true if the bean involves validation, false otherwise
      • getConstraintsForProperty

        PropertyDescriptor getConstraintsForProperty(String propertyName)
        Returns the property descriptor for a given property.

        Returns null if the property does not exist or has no constraint nor is marked as cascaded (see getConstrainedProperties()) Properties of super types are considered.

        Parameters:
        propertyName - property evaluated
        Returns:
        the property descriptor for a given property
        Throws:
        IllegalArgumentException - if propertyName is null
      • 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 PropertyDescriptors 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.

        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.

        Parameters:
        methodName - the name of the method
        parameterTypes - the parameter types of the method
        Returns:
        a method descriptor for the given method
        Throws:
        IllegalArgumentException - if methodName is null
        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 consider
        methodTypes - 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.

        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. 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

Traduction non disponible

Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.

Version en cache

21/08/2025 20:19:17 Cette version de la page est en cache (à la date du 21/08/2025 20:19:17) afin d'accélérer le traitement.
Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la version plus récente de la page.

Document créé le 11/06/2005, dernière modification le 18/08/2025
Source du document imprimé : https://www.gaudry.be/java-api-javaee-rf-javax/validation/metadata/beandescriptor.html

L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.

Références

  1. Consulter le document html Langue du document :fr Manuel PHP : https://docs.oracle.com

Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.