-
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 Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description T
getAnnotation()
Returns the annotation describing the constraint declaration.Map<String,Object>
getAttributes()
Returns a map containing the annotation attribute names as keys and the annotation attribute values as value.Set<ConstraintDescriptor<?>>
getComposingConstraints()
Return a set of composingConstraintDescriptor
s where each descriptor describes a composing constraint.List<Class<? extends ConstraintValidator<T,?>>>
getConstraintValidatorClasses()
List of the constraint validation implementation classes.Set<Class<?>>
getGroups()
The set of groups the constraint is applied on.String
getMessageTemplate()
The non-interpolated error messageSet<Class<? extends Payload>>
getPayload()
The set of payload the constraint hosts.ConstraintTarget
getValidationAppliesTo()
boolean
isReportAsSingleViolation()
-
-
-
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 theDefault
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()
- Returns:
- the
ConstraintTarget
value ornull
- 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 composingConstraintDescriptor
s where each descriptor describes a composing constraint.ConstraintDescriptor
instances of composing constraints reflect overridden attribute values ingetAttributes()
andgetAnnotation()
.- 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 withReportAsSingleViolation
-
-
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 16:52:35 Cette version de la page est en cache (à la date du 21/08/2025 16:52:35) 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/ConstraintDescriptor.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
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.