Top Description Methods
jakarta.validation.executable

public Interface ExecutableValidator

Imports
java.lang.reflect.Constructor, .Method, java.util.Set, jakarta.validation.ConstraintViolation, .ValidationException, jakarta.validation.groups.Default

Validates parameters and return values of methods and constructors. Implementations of this interface must be thread-safe.
Author
Gunnar Morling
Since
1.1

Method Summary

Modifier and TypeMethod and Description
public <
the type hosting the constructor to validate
T
>
Set<ConstraintViolation<T>>

Returns:

a set with the constraint violations caused by this validation; Will be empty if no error occurs, but never null
validateConstructorParameters
(Constructor<? extends T>
the constructor for which the parameter constraints is validated
constructor
,
Object[]
the values provided by the caller for the given constructor's parameters
parameterValues
,
Class<?>...
the group or list of groups targeted for validation (defaults to Default)
groups
)

Validates all constraints placed on the parameters of the given constructor.

public <
the type hosting the constructor to validate
T
>
Set<ConstraintViolation<T>>

Returns:

a set with the constraint violations caused by this validation; will be empty, if no error occurs, but never null
validateConstructorReturnValue
(Constructor<? extends T>
the constructor for which the return value constraints is validated
constructor
,
T
the object instantiated by the given method
createdObject
,
Class<?>...
the group or list of groups targeted for validation (defaults to Default)
groups
)

Validates all return value constraints of the given constructor.

public <
the type hosting the method to validate
T
>
Set<ConstraintViolation<T>>

Returns:

a set with the constraint violations caused by this validation; will be empty if no error occurs, but never null
validateParameters
(T
the object on which the method to validate is invoked
object
,
Method
the method for which the parameter constraints is validated
method
,
Object[]
the values provided by the caller for the given method's parameters
parameterValues
,
Class<?>...
the group or list of groups targeted for validation (defaults to Default)
groups
)

Validates all constraints placed on the parameters of the given method.

public <
the type hosting the method to validate
T
>
Set<ConstraintViolation<T>>

Returns:

a set with the constraint violations caused by this validation; will be empty if no error occurs, but never null
validateReturnValue
(T
the object on which the method to validate is invoked
object
,
Method
the method for which the return value constraints is validated
method
,
Object
the value returned by the given method
returnValue
,
Class<?>...
the group or list of groups targeted for validation (defaults to Default)
groups
)

Validates all return value constraints of the given method.

Method Detail

validateConstructorParametersback to summary
public <T> Set<ConstraintViolation<T>> validateConstructorParameters(Constructor<? extends T> constructor, Object[] parameterValues, Class<?>... groups)

Validates all constraints placed on the parameters of the given constructor.

Parameters
<T>
the type hosting the constructor to validate
constructor:Constructor<? extends T>

the constructor for which the parameter constraints is validated

parameterValues:Object[]

the values provided by the caller for the given constructor's parameters

groups:Class<?>[]

the group or list of groups targeted for validation (defaults to Default)

Returns:Set<ConstraintViolation<T>>

a set with the constraint violations caused by this validation; Will be empty if no error occurs, but never null

Exceptions
IllegalArgumentException:
if null is passed for any of the parameters or if parameters don't match with each other
ValidationException:
if a non recoverable error happens during the validation process
validateConstructorReturnValueback to summary
public <T> Set<ConstraintViolation<T>> validateConstructorReturnValue(Constructor<? extends T> constructor, T createdObject, Class<?>... groups)

Validates all return value constraints of the given constructor.

Parameters
<T>
the type hosting the constructor to validate
constructor:Constructor<? extends T>

the constructor for which the return value constraints is validated

createdObject:T

the object instantiated by the given method

groups:Class<?>[]

the group or list of groups targeted for validation (defaults to Default)

Returns:Set<ConstraintViolation<T>>

a set with the constraint violations caused by this validation; will be empty, if no error occurs, but never null

Exceptions
IllegalArgumentException:
if null is passed for any of the parameters or if parameters don't match with each other
ValidationException:
if a non recoverable error happens during the validation process
validateParametersback to summary
public <T> Set<ConstraintViolation<T>> validateParameters(T object, Method method, Object[] parameterValues, Class<?>... groups)

Validates all constraints placed on the parameters of the given method.

Parameters
<T>
the type hosting the method to validate
object:T

the object on which the method to validate is invoked

method:Method

the method for which the parameter constraints is validated

parameterValues:Object[]

the values provided by the caller for the given method's parameters

groups:Class<?>[]

the group or list of groups targeted for validation (defaults to Default)

Returns:Set<ConstraintViolation<T>>

a set with the constraint violations caused by this validation; will be empty if no error occurs, but never null

Exceptions
IllegalArgumentException:
if null is passed for any of the parameters or if parameters don't match with each other
ValidationException:
if a non recoverable error happens during the validation process
validateReturnValueback to summary
public <T> Set<ConstraintViolation<T>> validateReturnValue(T object, Method method, Object returnValue, Class<?>... groups)

Validates all return value constraints of the given method.

Parameters
<T>
the type hosting the method to validate
object:T

the object on which the method to validate is invoked

method:Method

the method for which the return value constraints is validated

returnValue:Object

the value returned by the given method

groups:Class<?>[]

the group or list of groups targeted for validation (defaults to Default)

Returns:Set<ConstraintViolation<T>>

a set with the constraint violations caused by this validation; will be empty if no error occurs, but never null

Exceptions
IllegalArgumentException:
if null is passed for any of the object, method or groups parameters or if parameters don't match with each other
ValidationException:
if a non recoverable error happens during the validation process