@Singleton @Primary @Requires(property="micronaut.validator.enabled", value="true", defaultValue="true") public class DefaultValidator extends Object implements Validator, ExecutableMethodValidator, ReactiveValidator, AnnotatedElementValidator, BeanDefinitionValidator
Validator interface.ANN_CONSTRAINT, ANN_VALIDDEFAULT| Modifier | Constructor and Description | 
|---|---|
| protected  | DefaultValidator(ValidatorConfiguration configuration)Default constructor. | 
| Modifier and Type | Method and Description | 
|---|---|
| <T> T | createValid(Class<T> beanType,
           Object... arguments)Create a new valid instance. | 
| ExecutableMethodValidator | forExecutables()Overridden variation that returns a  ExecutableMethodValidator. | 
| protected BeanIntrospection<Object> | getBeanIntrospection(Object object)looks up a bean introspection for the given object. | 
| protected BeanIntrospection<Object> | getBeanIntrospection(Object object,
                    Class<?> definedClass)looks up a bean introspection for the given object by instance's class or defined class. | 
| BeanDescriptor | getConstraintsForClass(Class<?> clazz) | 
| <T> T | unwrap(Class<T> type) | 
| <T> Set<ConstraintViolation<T>> | validate(BeanIntrospection<T> introspection,
        T object,
        Class<?>... groups)Validate the given introspection and object. | 
| <T> Set<ConstraintViolation<T>> | validate(T object,
        Class<?>... groups) | 
| <T> void | validateBean(BeanResolutionContext resolutionContext,
            BeanDefinition<T> definition,
            T bean)Validates the given bean after it has been constructor. | 
| <T> void | validateBeanArgument(BeanResolutionContext resolutionContext,
                    InjectionPoint injectionPoint,
                    Argument<T> argument,
                    int index,
                    T value)Validates the given bean after it has been constructor. | 
| <T> CompletionStage<T> | validateCompletionStage(CompletionStage<T> completionStage,
                       Class<?>... groups)Validate the given CompletionStage by returning a new CompletionStage that validates the emitted value. | 
| <T> Set<ConstraintViolation<T>> | validateConstructorParameters(BeanIntrospection<? extends T> introspection,
                             Object[] parameterValues,
                             Class<?>... groups)Validates parameters for the given introspection and values. | 
| <T> Set<ConstraintViolation<T>> | validateConstructorParameters(Class<? extends T> beanType,
                             Argument<?>[] constructorArguments,
                             Object[] parameterValues,
                             Class<?>[] groups)Validates arguments for the given bean type and constructor arguments. | 
| <T> Set<ConstraintViolation<T>> | validateConstructorParameters(Constructor<? extends T> constructor,
                             Object[] parameterValues,
                             Class<?>... groups) | 
| <T> Set<ConstraintViolation<T>> | validateConstructorReturnValue(Constructor<? extends T> constructor,
                              T createdObject,
                              Class<?>... groups) | 
| Set<String> | validatedAnnotatedElement(AnnotatedElement element,
                         Object value)Validates an annotated element for the given value. | 
| <T> Set<ConstraintViolation<T>> | validateParameters(T object,
                  ExecutableMethod method,
                  Collection<MutableArgumentValue<?>> argumentValues,
                  Class<?>... groups)Validate the parameter values of the given  ExecutableMethod. | 
| <T> Set<ConstraintViolation<T>> | validateParameters(T object,
                  ExecutableMethod method,
                  Object[] parameterValues,
                  Class<?>... groups)Validate the parameter values of the given  ExecutableMethod. | 
| <T> Set<ConstraintViolation<T>> | validateParameters(T object,
                  Method method,
                  Object[] parameterValues,
                  Class<?>... groups) | 
| <T> Set<ConstraintViolation<T>> | validateProperty(T object,
                String propertyName,
                Class<?>... groups) | 
| <T> Publisher<T> | validatePublisher(Publisher<T> publisher,
                 Class<?>... groups)Validate the given publisher by returning a new Publisher that validates each emitted value. | 
| <T> Set<ConstraintViolation<T>> | validateReturnValue(T object,
                   ExecutableMethod<?,Object> executableMethod,
                   Object returnValue,
                   Class<?>... groups)Validates the return value of a  ExecutableMethod. | 
| <T> Set<ConstraintViolation<T>> | validateReturnValue(T object,
                   Method method,
                   Object returnValue,
                   Class<?>... groups) | 
| <T> Set<ConstraintViolation<T>> | validateValue(Class<T> beanType,
             String propertyName,
             Object value,
             Class<?>... groups) | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetInstanceprotected DefaultValidator(@NonNull ValidatorConfiguration configuration)
configuration - The validator configuration@NonNull public <T> Set<ConstraintViolation<T>> validate(@NonNull T object, @Nullable Class<?>... groups)
@NonNull public <T> Set<ConstraintViolation<T>> validate(@NonNull BeanIntrospection<T> introspection, @NonNull T object, @Nullable Class<?>... groups)
T - The object typeintrospection - The introspectionobject - The objectgroups - The groups@NonNull public <T> Set<ConstraintViolation<T>> validateProperty(@NonNull T object, @NonNull String propertyName, @Nullable Class<?>... groups)
validateProperty in interface Validator@NonNull public <T> Set<ConstraintViolation<T>> validateValue(@NonNull Class<T> beanType, @NonNull String propertyName, @Nullable Object value, @Nullable Class<?>... groups)
validateValue in interface Validator@NonNull public Set<String> validatedAnnotatedElement(@NonNull AnnotatedElement element, @Nullable Object value)
AnnotatedElementValidatorvalidatedAnnotatedElement in interface AnnotatedElementValidatorelement - The elementvalue - The value@NonNull public <T> T createValid(@NonNull Class<T> beanType, Object... arguments) throws ConstraintViolationException
ExecutableMethodValidatorcreateValid in interface ExecutableMethodValidatorT - the generic typebeanType - The typearguments - The argumentsConstraintViolationException - If a valid instance couldn't be constructedpublic BeanDescriptor getConstraintsForClass(Class<?> clazz)
getConstraintsForClass in interface Validator@NonNull public ExecutableMethodValidator forExecutables()
ValidatorExecutableMethodValidator.forExecutables in interface Validator@NonNull public <T> Set<ConstraintViolation<T>> validateParameters(@NonNull T object, @NonNull ExecutableMethod method, @NonNull Object[] parameterValues, @Nullable Class<?>... groups)
ExecutableMethodValidatorExecutableMethod.validateParameters in interface ExecutableMethodValidatorT - The object typeobject - The objectmethod - The methodparameterValues - The valuesgroups - The groups@NonNull public <T> Set<ConstraintViolation<T>> validateParameters(@NonNull T object, @NonNull ExecutableMethod method, @NonNull Collection<MutableArgumentValue<?>> argumentValues, @Nullable Class<?>... groups)
ExecutableMethodValidatorExecutableMethod.validateParameters in interface ExecutableMethodValidatorT - The object typeobject - The objectmethod - The methodargumentValues - The valuesgroups - The groups@NonNull public <T> Set<ConstraintViolation<T>> validateParameters(@NonNull T object, @NonNull Method method, @NonNull Object[] parameterValues, @Nullable Class<?>... groups)
validateParameters in interface ExecutableMethodValidatorvalidateParameters in interface ExecutableValidator@NonNull public <T> Set<ConstraintViolation<T>> validateReturnValue(@NonNull T object, @NonNull Method method, @Nullable Object returnValue, @Nullable Class<?>... groups)
validateReturnValue in interface ExecutableMethodValidatorvalidateReturnValue in interface ExecutableValidator@NonNull public <T> Set<ConstraintViolation<T>> validateReturnValue(@NonNull T object, @NonNull ExecutableMethod<?,Object> executableMethod, @Nullable Object returnValue, @Nullable Class<?>... groups)
ExecutableMethodValidatorExecutableMethod.validateReturnValue in interface ExecutableMethodValidatorT - The object typeobject - The objectexecutableMethod - The methodreturnValue - The return valuegroups - The groups@NonNull public <T> Set<ConstraintViolation<T>> validateConstructorParameters(@NonNull Constructor<? extends T> constructor, @NonNull Object[] parameterValues, @Nullable Class<?>... groups)
validateConstructorParameters in interface ExecutableMethodValidatorvalidateConstructorParameters in interface ExecutableValidator@NonNull public <T> Set<ConstraintViolation<T>> validateConstructorParameters(@NonNull BeanIntrospection<? extends T> introspection, @NonNull Object[] parameterValues, @Nullable Class<?>... groups)
ExecutableMethodValidatorvalidateConstructorParameters in interface ExecutableMethodValidatorT - The bean type.introspection - The introspectionparameterValues - The parameter valuesgroups - The groupspublic <T> Set<ConstraintViolation<T>> validateConstructorParameters(Class<? extends T> beanType, Argument<?>[] constructorArguments, @NonNull Object[] parameterValues, @Nullable Class<?>[] groups)
ExecutableMethodValidatorvalidateConstructorParameters in interface ExecutableMethodValidatorT - The generic type of the beanbeanType - The bean typeconstructorArguments - The constructor argumentsparameterValues - The parameter valuesgroups - The validation groups@NonNull public <T> Set<ConstraintViolation<T>> validateConstructorReturnValue(@NonNull Constructor<? extends T> constructor, @NonNull T createdObject, @Nullable Class<?>... groups)
validateConstructorReturnValue in interface ExecutableMethodValidatorvalidateConstructorReturnValue in interface ExecutableValidator@Nullable protected BeanIntrospection<Object> getBeanIntrospection(@NonNull Object object, @NonNull Class<?> definedClass)
object - The object, never nulldefinedClass - The defined class of the object, never null@Nullable protected BeanIntrospection<Object> getBeanIntrospection(@NonNull Object object)
object - The object, never null@NonNull public <T> Publisher<T> validatePublisher(@NonNull Publisher<T> publisher, Class<?>... groups)
ReactiveValidatorConstraintViolationException will be thrown.validatePublisher in interface ReactiveValidatorT - The generic typepublisher - The publishergroups - The groups@NonNull public <T> CompletionStage<T> validateCompletionStage(@NonNull CompletionStage<T> completionStage, Class<?>... groups)
ReactiveValidatorConstraintViolationException will be thrown.validateCompletionStage in interface ReactiveValidatorT - The generic typecompletionStage - The completion stagegroups - The groupspublic <T> void validateBeanArgument(@NonNull BeanResolutionContext resolutionContext, @NonNull InjectionPoint injectionPoint, @NonNull Argument<T> argument, int index, @Nullable T value) throws BeanInstantiationException
BeanDefinitionValidatorvalidateBeanArgument in interface BeanDefinitionValidatorT - The bean typeresolutionContext - The resolution contextinjectionPoint - The injection pointargument - The argumentindex - The argument indexvalue - The valueBeanInstantiationException - if the bean is invalidpublic <T> void validateBean(@NonNull BeanResolutionContext resolutionContext, @NonNull BeanDefinition<T> definition, @NonNull T bean) throws BeanInstantiationException
BeanDefinitionValidatorvalidateBean in interface BeanDefinitionValidatorT - The bean typeresolutionContext - The resolution contextdefinition - The definitionbean - The bean to validateBeanInstantiationException - if the bean is invalid