javax.validation.metadata

Interface ConstraintDescriptor<T extends Annotation>


  • public interface ConstraintDescriptor<T extends Annotation>
    Describes a single constraint and its composing constraints.

    T is the constraint's annotation type.

    Author:
    Emmanuel Bernard, Hardy Ferentschik
    • Method Detail

      • getAnnotation

        T getAnnotation()
        Returns the annotation describing the constraint declaration. If a composing constraint, attribute values are reflecting the overridden attributes of the composing constraint
        Returns:
        the annotation for this constraint
      • getMessageTemplate

        String getMessageTemplate()
        The non-interpolated error message
        Returns:
        the non-interpolated error message
        Since:
        1.1
      • getGroups

        Set<Class<?>> getGroups()
        The set of groups the constraint is applied on. If the constraint declares no group, a set with only the Default group is returned.
        Returns:
        the groups the constraint is applied on
      • getPayload

        Set<Class<? extends Payload>> getPayload()
        The set of payload the constraint hosts.
        Returns:
        payload classes hosted on the constraint or an empty set if none
      • getValidationAppliesTo

        ConstraintTarget getValidationAppliesTo()
        The ConstraintTarget value of validationAppliesTo if the constraint hosts it or null otherwise.
        Returns:
        the ConstraintTarget value or null
        Since:
        1.1
      • getConstraintValidatorClasses

        List<Class<? extends ConstraintValidator<T,?>>> getConstraintValidatorClasses()
        List of the constraint validation implementation classes.
        Returns:
        list of the constraint validation implementation classes
      • getAttributes

        Map<String,Object> getAttributes()
        Returns a map containing the annotation attribute names as keys and the annotation attribute values as value.

        If this constraint is used as part of a composed constraint, attribute values are reflecting the overridden attribute of the composing constraint.

        Returns:
        a map containing the annotation attribute names as keys and the annotation attribute values as value
      • getComposingConstraints

        Set<ConstraintDescriptor<?>> getComposingConstraints()
        Return a set of composing ConstraintDescriptors where each descriptor describes a composing constraint. ConstraintDescriptor instances of composing constraints reflect overridden attribute values in getAttributes() and getAnnotation().
        Returns:
        a set of ConstraintDescriptor objects or an empty set in case there are no composing constraints
      • isReportAsSingleViolation

        boolean isReportAsSingleViolation()
        Returns:
        true if the constraint is annotated with ReportAsSingleViolation

Document created the 11/06/2005, last modified the 18/08/2025
Source of the printed document:https://www.gaudry.be/en/java-api-javaee-rf-javax/validation/metadata/ConstraintDescriptor.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.

References

  1. View the html document Language of the document:fr Manuel PHP : https://docs.oracle.com, ConstraintDescriptor (Java(TM) EE 7 Specification APIs)

These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author of this site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.