Interface Validator

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

    public interface Validator
    extends javax.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
    • Field Summary

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

      All Methods Static Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      ExecutableMethodValidator forExecutables()
      Overridden variation that returns a ExecutableMethodValidator.
      static Validator getInstance()
      Constructs a new default instance.
      <T> java.util.Set<javax.validation.ConstraintViolation<T>> validate​(io.micronaut.core.beans.BeanIntrospection<T> introspection, T object, java.lang.Class<?>... groups)
      Validate the given introspection and object.
      <T> java.util.Set<javax.validation.ConstraintViolation<T>> validate​(T object, java.lang.Class<?>... groups)  
      <T> java.util.Set<javax.validation.ConstraintViolation<T>> validateProperty​(T object, java.lang.String propertyName, java.lang.Class<?>... groups)  
      <T> java.util.Set<javax.validation.ConstraintViolation<T>> validateValue​(java.lang.Class<T> beanType, java.lang.String propertyName, java.lang.Object value, java.lang.Class<?>... groups)  
      • Methods inherited from interface javax.validation.Validator

        getConstraintsForClass, unwrap
    • Field Detail

      • ANN_VALID

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

        static final java.lang.String ANN_CONSTRAINT
        Annotation used to define a constraint.
    • Method Detail

      • validate

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

        @NonNull
        <T> java.util.Set<javax.validation.ConstraintViolation<T>> validate​(@NonNull
                                                                            io.micronaut.core.beans.BeanIntrospection<T> introspection,
                                                                            @NonNull
                                                                            T object,
                                                                            @Nullable
                                                                            java.lang.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> java.util.Set<javax.validation.ConstraintViolation<T>> validateProperty​(@NonNull
                                                                                    T object,
                                                                                    @NonNull
                                                                                    java.lang.String propertyName,
                                                                                    java.lang.Class<?>... groups)
        Specified by:
        validateProperty in interface javax.validation.Validator
      • validateValue

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

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