Class MicronautHibernateValidator
java.lang.Object
io.micronaut.validation.validator.DefaultValidator
io.micronaut.configuration.hibernate.validator.MicronautHibernateValidator
- All Implemented Interfaces:
io.micronaut.inject.annotation.AnnotatedElementValidator
,io.micronaut.inject.validation.BeanDefinitionValidator
,io.micronaut.validation.validator.ExecutableMethodValidator
,io.micronaut.validation.validator.ReactiveValidator
,io.micronaut.validation.validator.Validator
,jakarta.validation.executable.ExecutableValidator
,jakarta.validation.Validator
@Singleton
@Primary
@Requires(property="micronaut.validator.enabled",
value="true",
defaultValue="true")
@Replaces(io.micronaut.validation.validator.DefaultValidator.class)
public class MicronautHibernateValidator
extends io.micronaut.validation.validator.DefaultValidator
implements io.micronaut.validation.validator.Validator, io.micronaut.validation.validator.ExecutableMethodValidator, io.micronaut.validation.validator.ReactiveValidator, io.micronaut.inject.annotation.AnnotatedElementValidator, io.micronaut.inject.validation.BeanDefinitionValidator
Replaces Micronaut Validator with Hibernate backed implementation.
- Since:
- 2.0.0
- Author:
- graemerocher
-
Field Summary
Fields inherited from interface io.micronaut.inject.validation.BeanDefinitionValidator
DEFAULT
Fields inherited from interface io.micronaut.validation.validator.Validator
ANN_CONSTRAINT, ANN_VALID
-
Constructor Summary
ModifierConstructorDescriptionprotected
MicronautHibernateValidator
(jakarta.validation.ValidatorFactory validatorFactory, @NonNull io.micronaut.validation.validator.ValidatorConfiguration configuration) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionjakarta.validation.metadata.BeanDescriptor
getConstraintsForClass
(Class<?> clazz) <T> T
<T> @NonNull Set<jakarta.validation.ConstraintViolation<T>>
<T> void
validateBean
(@NonNull io.micronaut.context.BeanResolutionContext resolutionContext, @NonNull io.micronaut.inject.BeanDefinition<T> definition, T bean) <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>>
validateProperty
(T object, @NonNull String propertyName, @Nullable Class<?>... groups) <T> @NonNull Set<jakarta.validation.ConstraintViolation<T>>
validateReturnValue
(T object, @NonNull Method method, @Nullable Object returnValue, @Nullable Class<?>... groups) <T> @NonNull Set<jakarta.validation.ConstraintViolation<T>>
validateValue
(@NonNull Class<T> beanType, @NonNull String propertyName, @Nullable Object value, @Nullable Class<?>... groups) Methods inherited from class io.micronaut.validation.validator.DefaultValidator
createValid, forExecutables, getBeanIntrospection, getBeanIntrospection, getBeanIntrospection, getBeanIntrospector, requireNonEmpty, requireNonNull, validate, validateBeanArgument, validateCompletionStage, validateConstructorParameters, validateConstructorParameters, validatedAnnotatedElement, validateParameters, validateParameters, validateParameters, validatePublisher, validateReturnValue
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.inject.annotation.AnnotatedElementValidator
validatedAnnotatedElement
Methods inherited from interface io.micronaut.inject.validation.BeanDefinitionValidator
validateBeanArgument
Methods inherited from interface io.micronaut.validation.validator.ExecutableMethodValidator
createValid, validateConstructorParameters, validateConstructorParameters, validateParameters, validateParameters, validateParameters, validateReturnValue
Methods inherited from interface io.micronaut.validation.validator.ReactiveValidator
validateCompletionStage, validatePublisher
Methods inherited from interface io.micronaut.validation.validator.Validator
forExecutables, validate
-
Constructor Details
-
MicronautHibernateValidator
protected MicronautHibernateValidator(jakarta.validation.ValidatorFactory validatorFactory, @NonNull @NonNull io.micronaut.validation.validator.ValidatorConfiguration configuration) Default constructor.- Parameters:
validatorFactory
- The validator factoryconfiguration
- The validator configuration
-
-
Method Details
-
validate
@NonNull public <T> @NonNull Set<jakarta.validation.ConstraintViolation<T>> validate(@NonNull T object, @Nullable @Nullable Class<?>... groups) - Specified by:
validate
in interfaceio.micronaut.validation.validator.Validator
- Specified by:
validate
in interfacejakarta.validation.Validator
- Overrides:
validate
in classio.micronaut.validation.validator.DefaultValidator
-
validateProperty
@NonNull public <T> @NonNull Set<jakarta.validation.ConstraintViolation<T>> validateProperty(@NonNull T object, @NonNull @NonNull String propertyName, @Nullable @Nullable Class<?>... groups) - Specified by:
validateProperty
in interfaceio.micronaut.validation.validator.Validator
- Specified by:
validateProperty
in interfacejakarta.validation.Validator
- Overrides:
validateProperty
in classio.micronaut.validation.validator.DefaultValidator
-
validateValue
@NonNull public <T> @NonNull Set<jakarta.validation.ConstraintViolation<T>> validateValue(@NonNull @NonNull Class<T> beanType, @NonNull @NonNull String propertyName, @Nullable @Nullable Object value, @Nullable @Nullable Class<?>... groups) - Specified by:
validateValue
in interfaceio.micronaut.validation.validator.Validator
- Specified by:
validateValue
in interfacejakarta.validation.Validator
- Overrides:
validateValue
in classio.micronaut.validation.validator.DefaultValidator
-
getConstraintsForClass
- Specified by:
getConstraintsForClass
in interfacejakarta.validation.Validator
- Overrides:
getConstraintsForClass
in classio.micronaut.validation.validator.DefaultValidator
-
unwrap
- Specified by:
unwrap
in interfacejakarta.validation.Validator
- Overrides:
unwrap
in classio.micronaut.validation.validator.DefaultValidator
-
validateReturnValue
@NonNull public <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 interfaceio.micronaut.validation.validator.ExecutableMethodValidator
- Specified by:
validateReturnValue
in interfacejakarta.validation.executable.ExecutableValidator
- Overrides:
validateReturnValue
in classio.micronaut.validation.validator.DefaultValidator
-
validateConstructorParameters
@NonNull public <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 interfaceio.micronaut.validation.validator.ExecutableMethodValidator
- Specified by:
validateConstructorParameters
in interfacejakarta.validation.executable.ExecutableValidator
- Overrides:
validateConstructorParameters
in classio.micronaut.validation.validator.DefaultValidator
-
validateConstructorReturnValue
@NonNull public <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 interfaceio.micronaut.validation.validator.ExecutableMethodValidator
- Specified by:
validateConstructorReturnValue
in interfacejakarta.validation.executable.ExecutableValidator
- Overrides:
validateConstructorReturnValue
in classio.micronaut.validation.validator.DefaultValidator
-
validateBean
public <T> void validateBean(@NonNull @NonNull io.micronaut.context.BeanResolutionContext resolutionContext, @NonNull @NonNull io.micronaut.inject.BeanDefinition<T> definition, @NonNull T bean) throws io.micronaut.context.exceptions.BeanInstantiationException - Specified by:
validateBean
in interfaceio.micronaut.inject.validation.BeanDefinitionValidator
- Overrides:
validateBean
in classio.micronaut.validation.validator.DefaultValidator
- Throws:
io.micronaut.context.exceptions.BeanInstantiationException
-