Interface ExecutableMethodValidator
- All Superinterfaces:
jakarta.validation.executable.ExecutableValidator
- All Known Implementing Classes:
DefaultAnnotatedElementValidator
,DefaultValidator
public interface ExecutableMethodValidator
extends jakarta.validation.executable.ExecutableValidator
Extended version of
ExecutableValidator
that operates on ExecutableMethod
instances.- Since:
- 1.2
- Author:
- graemerocher
-
Method Summary
Modifier and TypeMethodDescription<T> T
createValid
(@NonNull Class<T> type, Object... arguments) Create a new valid instance.<T> @NonNull Set<jakarta.validation.ConstraintViolation<T>>
validateConstructorParameters
(@NonNull io.micronaut.core.beans.BeanIntrospection<? extends T> introspection, @NonNull Object[] parameterValues, @Nullable Class<?>... groups) Validates parameters for the given introspection and values.<T> Set<jakarta.validation.ConstraintViolation<T>>
validateConstructorParameters
(@NonNull Class<? extends T> beanType, @NonNull io.micronaut.core.type.Argument<?>[] constructorArguments, @NonNull Object[] parameterValues, @Nullable Class<?>[] groups) Validates arguments for the given bean type and constructor arguments.<T> @NonNull Set<jakarta.validation.ConstraintViolation<T>>
validateConstructorParameters
(@NonNull Constructor<? extends T> constructor, @NonNull Object[] parameterValues, @Nullable Class<?>... groups) <T> @NonNull Set<jakarta.validation.ConstraintViolation<T>>
validateConstructorReturnValue
(@NonNull Constructor<? extends T> constructor, T createdObject, @Nullable Class<?>... groups) <T> @NonNull Set<jakarta.validation.ConstraintViolation<T>>
validateParameters
(T object, @NonNull io.micronaut.inject.ExecutableMethod method, @NonNull Object[] parameterValues, @Nullable Class<?>... groups) Validate the parameter values of the givenExecutableMethod
.<T> @NonNull Set<jakarta.validation.ConstraintViolation<T>>
validateParameters
(T object, @NonNull io.micronaut.inject.ExecutableMethod method, @NonNull Collection<io.micronaut.core.type.MutableArgumentValue<?>> argumentValues, @Nullable Class<?>... groups) Validate the parameter values of the givenExecutableMethod
.<T> @NonNull Set<jakarta.validation.ConstraintViolation<T>>
validateParameters
(T object, @NonNull Method method, @NonNull Object[] parameterValues, @Nullable Class<?>... groups) <T> @NonNull Set<jakarta.validation.ConstraintViolation<T>>
validateReturnValue
(T object, @NonNull io.micronaut.inject.ExecutableMethod<?, Object> executableMethod, @Nullable Object returnValue, @Nullable Class<?>... groups) Validates the return value of aExecutableMethod
.<T> @NonNull Set<jakarta.validation.ConstraintViolation<T>>
validateReturnValue
(T object, @NonNull Method method, @Nullable Object returnValue, @Nullable Class<?>... groups)
-
Method Details
-
createValid
@NonNull <T> T createValid(@NonNull @NonNull Class<T> type, Object... arguments) throws jakarta.validation.ConstraintViolationException Create a new valid instance.- Type Parameters:
T
- the generic type- Parameters:
type
- The typearguments
- The arguments- Returns:
- The instance
- Throws:
jakarta.validation.ConstraintViolationException
- If a valid instance couldn't be constructedIllegalArgumentException
- If an argument is invalid
-
validateParameters
@NonNull <T> @NonNull Set<jakarta.validation.ConstraintViolation<T>> validateParameters(@NonNull T object, @NonNull @NonNull io.micronaut.inject.ExecutableMethod method, @NonNull @NonNull Object[] parameterValues, @Nullable @Nullable Class<?>... groups) Validate the parameter values of the givenExecutableMethod
.- Type Parameters:
T
- The object type- Parameters:
object
- The objectmethod
- The methodparameterValues
- The valuesgroups
- The groups- Returns:
- The constraint violations.
-
validateParameters
@NonNull <T> @NonNull Set<jakarta.validation.ConstraintViolation<T>> validateParameters(@NonNull T object, @NonNull @NonNull io.micronaut.inject.ExecutableMethod method, @NonNull @NonNull Collection<io.micronaut.core.type.MutableArgumentValue<?>> argumentValues, @Nullable @Nullable Class<?>... groups) Validate the parameter values of the givenExecutableMethod
.- Type Parameters:
T
- The object type- Parameters:
object
- The objectmethod
- The methodargumentValues
- The valuesgroups
- The groups- Returns:
- The constraint violations.
-
validateReturnValue
@NonNull <T> @NonNull Set<jakarta.validation.ConstraintViolation<T>> validateReturnValue(@NonNull T object, @NonNull @NonNull io.micronaut.inject.ExecutableMethod<?, Object> executableMethod, @Nullable @Nullable Object returnValue, @Nullable @Nullable Class<?>... groups) Validates the return value of aExecutableMethod
.- Type Parameters:
T
- The object type- Parameters:
object
- The objectexecutableMethod
- The methodreturnValue
- The return valuegroups
- The groups- Returns:
- A set of contstraint violations
-
validateConstructorParameters
@NonNull <T> @NonNull Set<jakarta.validation.ConstraintViolation<T>> validateConstructorParameters(@NonNull @NonNull io.micronaut.core.beans.BeanIntrospection<? extends T> introspection, @NonNull @NonNull Object[] parameterValues, @Nullable @Nullable Class<?>... groups) Validates parameters for the given introspection and values.- Type Parameters:
T
- The bean type.- Parameters:
introspection
- The introspectionparameterValues
- The parameter valuesgroups
- The groups- Returns:
- The constraint violations
-
validateConstructorParameters
<T> Set<jakarta.validation.ConstraintViolation<T>> validateConstructorParameters(@NonNull @NonNull Class<? extends T> beanType, @NonNull @NonNull io.micronaut.core.type.Argument<?>[] constructorArguments, @NonNull @NonNull Object[] parameterValues, @Nullable @Nullable Class<?>[] groups) Validates arguments for the given bean type and constructor arguments.- Type Parameters:
T
- The generic type of the bean- Parameters:
beanType
- The bean typeconstructorArguments
- The constructor argumentsparameterValues
- The parameter valuesgroups
- The validation groups- Returns:
- A set of constraint violations, if any
-
validateParameters
@NonNull <T> @NonNull Set<jakarta.validation.ConstraintViolation<T>> validateParameters(@NonNull T object, @NonNull @NonNull Method method, @NonNull @NonNull Object[] parameterValues, @Nullable @Nullable Class<?>... groups) - Specified by:
validateParameters
in interfacejakarta.validation.executable.ExecutableValidator
-
validateReturnValue
@NonNull <T> @NonNull Set<jakarta.validation.ConstraintViolation<T>> validateReturnValue(@NonNull T object, @NonNull @NonNull Method method, @Nullable @Nullable Object returnValue, @Nullable @Nullable Class<?>... groups) - Specified by:
validateReturnValue
in interfacejakarta.validation.executable.ExecutableValidator
-
validateConstructorParameters
@NonNull <T> @NonNull Set<jakarta.validation.ConstraintViolation<T>> validateConstructorParameters(@NonNull @NonNull Constructor<? extends T> constructor, @NonNull @NonNull Object[] parameterValues, @Nullable @Nullable Class<?>... groups) - Specified by:
validateConstructorParameters
in interfacejakarta.validation.executable.ExecutableValidator
-
validateConstructorReturnValue
@NonNull <T> @NonNull Set<jakarta.validation.ConstraintViolation<T>> validateConstructorReturnValue(@NonNull @NonNull Constructor<? extends T> constructor, @NonNull T createdObject, @Nullable @Nullable Class<?>... groups) - Specified by:
validateConstructorReturnValue
in interfacejakarta.validation.executable.ExecutableValidator
-