Interface Validator

All Superinterfaces:
jakarta.validation.Validator
All Known Implementing Classes:
DefaultAnnotatedElementValidator, DefaultValidator

public interface Validator extends jakarta.validation.Validator
Extended version of the Valid interface for Micronaut's implementation.

The Validator.getConstraintsForClass(Class) method is not supported by the implementation.

Since:
1.2
Author:
graemerocher
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Annotation used to define a constraint.
    static final String
    Annotation used to define an object as valid.
  • Method Summary

    Modifier and Type
    Method
    Description
    Overridden variation that returns a ExecutableMethodValidator.
    static @NonNull Validator
    Constructs a new default instance.
    <T> @NonNull Set<jakarta.validation.ConstraintViolation<T>>
    validate(@NonNull io.micronaut.core.beans.BeanIntrospection<T> introspection, T object, @Nullable Class<?>... groups)
    Validate the given introspection and object.
    <T> @NonNull Set<jakarta.validation.ConstraintViolation<T>>
    validate(T object, Class<?>... groups)
     
    <T> @NonNull Set<jakarta.validation.ConstraintViolation<T>>
    validateProperty(T object, @NonNull String propertyName, Class<?>... groups)
     
    <T> @NonNull Set<jakarta.validation.ConstraintViolation<T>>
    validateValue(@NonNull Class<T> beanType, @NonNull String propertyName, @Nullable Object value, Class<?>... groups)
     

    Methods inherited from interface jakarta.validation.Validator

    getConstraintsForClass, unwrap
  • Field Details

    • ANN_VALID

      static final String ANN_VALID
      Annotation used to define an object as valid.
    • ANN_CONSTRAINT

      static final String ANN_CONSTRAINT
      Annotation used to define a constraint.
  • Method Details

    • forExecutables

      @NonNull @NonNull ExecutableMethodValidator forExecutables()
      Overridden variation that returns a ExecutableMethodValidator.
      Specified by:
      forExecutables in interface jakarta.validation.Validator
      Returns:
      The validator
    • validate

      @NonNull <T> @NonNull Set<jakarta.validation.ConstraintViolation<T>> validate(@NonNull T object, Class<?>... groups)
      Specified by:
      validate in interface jakarta.validation.Validator
    • validate

      @NonNull <T> @NonNull Set<jakarta.validation.ConstraintViolation<T>> validate(@NonNull @NonNull io.micronaut.core.beans.BeanIntrospection<T> introspection, @NonNull T object, @Nullable @Nullable Class<?>... groups)
      Validate the given introspection and object.
      Type Parameters:
      T - The object type
      Parameters:
      introspection - The introspection
      object - The object
      groups - The groups
      Returns:
      The constraint violations
    • validateProperty

      @NonNull <T> @NonNull Set<jakarta.validation.ConstraintViolation<T>> validateProperty(@NonNull T object, @NonNull @NonNull String propertyName, Class<?>... groups)
      Specified by:
      validateProperty in interface jakarta.validation.Validator
    • validateValue

      @NonNull <T> @NonNull Set<jakarta.validation.ConstraintViolation<T>> validateValue(@NonNull @NonNull Class<T> beanType, @NonNull @NonNull String propertyName, @Nullable @Nullable Object value, Class<?>... groups)
      Specified by:
      validateValue in interface jakarta.validation.Validator
    • getInstance

      @NonNull static @NonNull Validator getInstance()
      Constructs a new default instance. Note that the returned instance will not contain managed ConstraintValidator instances and using Inject should be preferred.
      Returns:
      The validator.