Top Description Methods
org.hibernate.validator.cfg

public Interface ConstraintMapping

Known Direct Implementers
org.hibernate.validator.internal.cfg.context.DefaultConstraintMapping
Imports
java.lang.annotation.Annotation, org.hibernate.validator.cfg.context.ConstraintDefinitionContext, .TypeConstraintMappingContext

Represents a constraint mapping configured via the programmatic API.
Authors
Hardy Ferentschik, Gunnar Morling, Kevin Pollet <[email protected]> (C) 2011 SERLI, Yoann Rodiere

Method Summary

Modifier and TypeMethod and Description
public <
The annotation type to be configured.
A extends Annotation
>
ConstraintDefinitionContext<A>

Returns:

Instance allowing for defining validators to be executed for the specified constraint.
constraintDefinition
(Class<A>
The annotation class on which to define the validators. This type must be an @interface annotated with jakarta.validation.Constraint. All validators defined after calling this method are added to the annotation of the type annotationClass until the next call of type or annotation.
annotationClass
)

Starts defining jakarta.validation.ConstraintValidators to be executed for the specified constraint (i.e. annotation class).

public <
The type to be configured.
C
>
TypeConstraintMappingContext<C>

Returns:

Instance allowing for defining constraints on the specified class.
type
(Class<C>
The bean class on which to define constraints. All constraints defined after calling this method are added to the bean of the type beanClass until the next call of type or annotation.
beanClass
)

Deprecated as a consequence of TypeConstraintMappingContext being deprecated.
Starts defining constraints on the specified bean class.

Method Detail

constraintDefinitionback to summary
public <A extends Annotation> ConstraintDefinitionContext<A> constraintDefinition(Class<A> annotationClass)

Starts defining jakarta.validation.ConstraintValidators to be executed for the specified constraint (i.e. annotation class). Each constraint may only be configured once within all constraint mappings used for configuring one validator factory.

Parameters
<A>
The annotation type to be configured.
annotationClass:Class<A>

The annotation class on which to define the validators. This type must be an @interface annotated with jakarta.validation.Constraint. All validators defined after calling this method are added to the annotation of the type annotationClass until the next call of type or annotation.

Returns:ConstraintDefinitionContext<A>

Instance allowing for defining validators to be executed for the specified constraint.

Since
5.3
typeback to summary
public <C> TypeConstraintMappingContext<C> type(Class<C> beanClass)

Deprecated

as a consequence of TypeConstraintMappingContext being deprecated. See corresponding docs for further information.

Starts defining constraints on the specified bean class. Each bean class may only be configured once within all constraint mappings used for configuring one validator factory.

Parameters
<C>
The type to be configured.
beanClass:Class<C>

The bean class on which to define constraints. All constraints defined after calling this method are added to the bean of the type beanClass until the next call of type or annotation.

Returns:TypeConstraintMappingContext<C>

Instance allowing for defining constraints on the specified class.