Class DefaultValidator

java.lang.Object
io.micronaut.validation.validator.DefaultValidator
All Implemented Interfaces:
io.micronaut.inject.annotation.AnnotatedElementValidator, io.micronaut.inject.validation.BeanDefinitionValidator, ExecutableMethodValidator, ReactiveValidator, Validator, jakarta.validation.executable.ExecutableValidator, jakarta.validation.Validator
Direct Known Subclasses:
DefaultAnnotatedElementValidator

@Singleton @Primary @Requires(property="micronaut.validator.enabled", value="true", defaultValue="true") public class DefaultValidator extends Object implements Validator, ExecutableMethodValidator, ReactiveValidator, io.micronaut.inject.annotation.AnnotatedElementValidator, io.micronaut.inject.validation.BeanDefinitionValidator
Default implementation of the Validator interface.
Since:
1.2
Author:
graemerocher, Andriy Dmytruk
  • 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

    Constructors
    Constructor
    Description
    DefaultValidator(@NonNull ValidatorConfiguration configuration)
    Default constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    createValid(@NonNull Class<T> beanType, Object... arguments)
    Create a new valid instance.
    Overridden variation that returns a ExecutableMethodValidator.
    protected <T> @Nullable io.micronaut.core.beans.BeanIntrospection<T>
    getBeanIntrospection(@NonNull Class<T> type)
    Looks up a bean introspection for the given object.
    protected <T> @Nullable io.micronaut.core.beans.BeanIntrospection<T>
    Looks up a bean introspection for the given object.
    protected <T> @Nullable io.micronaut.core.beans.BeanIntrospection<T>
    getBeanIntrospection(T object, @NonNull Class<T> definedClass)
    looks up a bean introspection for the given object by instance's class or defined class.
    io.micronaut.core.beans.BeanIntrospector
     
    jakarta.validation.metadata.BeanDescriptor
     
    static String
    Deprecated.
    It will be private in a future version.
    static <T> T
    requireNonNull(String name, T value)
    Deprecated.
    It will be private in a future version.
    <T> T
    unwrap(Class<T> type)
     
    <T> @NonNull Set<jakarta.validation.ConstraintViolation<T>>
    validate(@NonNull io.micronaut.core.beans.BeanIntrospection<T> introspection, T object, @NonNull Class<?>... groups)
    Validate the given introspection and object.
    <T> Set<jakarta.validation.ConstraintViolation<T>>
    validate(io.micronaut.core.beans.BeanIntrospection<T> introspection, T object, BeanValidationContext context)
    Validate the given introspection and object.
    <T> @NonNull Set<jakarta.validation.ConstraintViolation<T>>
    validate(T object, @Nullable Class<?>... groups)
     
    <T> Set<jakarta.validation.ConstraintViolation<T>>
    validate(T object, BeanValidationContext validationContext)
    Validates all constraints on object.
    <T> void
    validateBean(@NonNull io.micronaut.context.BeanResolutionContext resolutionContext, @NonNull io.micronaut.inject.BeanDefinition<T> definition, T bean)
     
    <T> void
    validateBeanArgument(@NonNull io.micronaut.context.BeanResolutionContext resolutionContext, @NonNull io.micronaut.inject.InjectionPoint injectionPoint, @NonNull io.micronaut.core.type.Argument<T> argument, int index, T value)
     
    <T> @NonNull CompletionStage<T>
    validateCompletionStage(@NonNull CompletionStage<T> completionStage, @NonNull io.micronaut.core.type.Argument<T> argument, @NonNull Class<?>... groups)
    Validate the given CompletionStage by returning a new CompletionStage that validates the emitted value.
    <T> @NonNull Set<jakarta.validation.ConstraintViolation<T>>
    validateConstructorParameters(@NonNull io.micronaut.core.beans.BeanIntrospection<? extends T> introspection, @NonNull Object[] parameterValues, @NonNull Class<?>... groups)
    Validates parameters for the given introspection and values.
    <T> @NonNull Set<jakarta.validation.ConstraintViolation<T>>
    validateConstructorParameters(@NonNull Constructor<? extends T> constructor, @NonNull Object[] parameterValues, @NonNull Class<?>... groups)
     
    <T> Set<jakarta.validation.ConstraintViolation<T>>
    validateConstructorParameters(Class<? extends T> beanType, @NonNull io.micronaut.core.type.Argument<?>[] constructorArguments, @NonNull Object[] parameterValues, BeanValidationContext validationContext)
    Validates arguments for the given bean type and constructor arguments.
    <T> Set<jakarta.validation.ConstraintViolation<T>>
    validateConstructorParameters(Class<? extends T> beanType, io.micronaut.core.type.Argument<?>[] constructorArguments, @NonNull Object[] parameterValues, @NonNull Class<?>[] groups)
    Validates arguments for the given bean type and constructor arguments.
    <T> @NonNull Set<jakarta.validation.ConstraintViolation<T>>
    validateConstructorReturnValue(@NonNull Constructor<? extends T> constructor, T createdObject, @NonNull Class<?>... groups)
     
    @NonNull Set<String>
    validatedAnnotatedElement(@NonNull io.micronaut.core.annotation.AnnotatedElement element, @Nullable Object value)
     
    <T> @NonNull Set<jakarta.validation.ConstraintViolation<T>>
    validateParameters(T object, @NonNull io.micronaut.inject.ExecutableMethod method, @NonNull Object[] parameterValues, @NonNull Class<?>... groups)
    Validate the parameter values of the given ExecutableMethod.
    <T> @NonNull Set<jakarta.validation.ConstraintViolation<T>>
    validateParameters(T object, @NonNull io.micronaut.inject.ExecutableMethod method, @NonNull Collection<io.micronaut.core.type.MutableArgumentValue<?>> argumentValues, @NonNull Class<?>... groups)
    Validate the parameter values of the given ExecutableMethod.
    <T> @NonNull Set<jakarta.validation.ConstraintViolation<T>>
    validateParameters(T object, @NonNull Method method, @NonNull Object[] parameterValues, @NonNull Class<?>... groups)
     
    <T> Set<jakarta.validation.ConstraintViolation<T>>
    validateParameters(T object, io.micronaut.inject.ExecutableMethod method, @NonNull Object[] parameterValues, BeanValidationContext validationContext)
    Validate the parameter values of the given ExecutableMethod.
    <T> @NonNull Set<jakarta.validation.ConstraintViolation<T>>
    validateProperty(T object, @NonNull String propertyName, @NonNull Class<?>... groups)
     
    <T> Set<jakarta.validation.ConstraintViolation<T>>
    validateProperty(T object, String propertyName, BeanValidationContext context)
    Validates all constraints placed on the property of object named propertyName.
    <T> @NonNull org.reactivestreams.Publisher<T>
    validatePublisher(@NonNull io.micronaut.core.type.ReturnType<?> returnType, @NonNull org.reactivestreams.Publisher<T> publisher, @NonNull Class<?>... groups)
    Validate the given publisher by returning a new Publisher that validates each emitted value.
    <T> @NonNull Set<jakarta.validation.ConstraintViolation<T>>
    validateReturnValue(T bean, @NonNull io.micronaut.inject.ExecutableMethod<?,Object> executableMethod, @Nullable Object returnValue, @NonNull Class<?>... groups)
    Validates the return value of a ExecutableMethod.
    <T> @NonNull Set<jakarta.validation.ConstraintViolation<T>>
    validateReturnValue(T object, @NonNull Method method, @Nullable Object returnValue, @NonNull Class<?>... groups)
     
    <T> Set<jakarta.validation.ConstraintViolation<T>>
    validateReturnValue(T bean, io.micronaut.inject.ExecutableMethod<?,Object> executableMethod, Object returnValue, BeanValidationContext validationContext)
    Validates the return value of a ExecutableMethod.
    <T> @NonNull Set<jakarta.validation.ConstraintViolation<T>>
    validateValue(@NonNull Class<T> beanType, @NonNull String propertyName, @Nullable Object value, @NonNull Class<?>... groups)
     
    <T> Set<jakarta.validation.ConstraintViolation<T>>
    validateValue(Class<T> beanType, String propertyName, Object value, BeanValidationContext context)
    Validates all constraints placed on the property named propertyName of the class beanType would the property value be value.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DefaultValidator

      public DefaultValidator(@NonNull @NonNull ValidatorConfiguration configuration)
      Default constructor.
      Parameters:
      configuration - The validator configuration
  • Method Details

    • getBeanIntrospector

      public io.micronaut.core.beans.BeanIntrospector getBeanIntrospector()
      Returns:
      The bean introspector
    • validate

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

      public <T> Set<jakarta.validation.ConstraintViolation<T>> validate(T object, BeanValidationContext validationContext)
      Description copied from interface: Validator
      Validates all constraints on object.
      Specified by:
      validate in interface Validator
      Type Parameters:
      T - the type of the object to validate
      Parameters:
      object - object to validate
      validationContext - The context
      Returns:
      constraint violations or an empty set if none
    • validate

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

      public <T> Set<jakarta.validation.ConstraintViolation<T>> validate(io.micronaut.core.beans.BeanIntrospection<T> introspection, T object, BeanValidationContext context)
      Description copied from interface: Validator
      Validate the given introspection and object.
      Specified by:
      validate in interface Validator
      Type Parameters:
      T - The object type
      Parameters:
      introspection - The introspection
      object - The object
      context - The context
      Returns:
      The constraint violations
    • validateProperty

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

      public <T> Set<jakarta.validation.ConstraintViolation<T>> validateProperty(T object, String propertyName, BeanValidationContext context)
      Description copied from interface: Validator
      Validates all constraints placed on the property of object named propertyName.
      Specified by:
      validateProperty in interface Validator
      Type Parameters:
      T - the type of the object to validate
      Parameters:
      object - object to validate
      propertyName - property to validate (i.e. field and getter constraints)
      context - The context
      Returns:
      constraint violations or an empty set if none
    • validateValue

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

      public <T> Set<jakarta.validation.ConstraintViolation<T>> validateValue(Class<T> beanType, String propertyName, Object value, BeanValidationContext context)
      Description copied from interface: Validator
      Validates all constraints placed on the property named propertyName of the class beanType would the property value be value.

      ConstraintViolation objects return null for ConstraintViolation.getRootBean() and ConstraintViolation.getLeafBean().

      Specified by:
      validateValue in interface Validator
      Type Parameters:
      T - the type of the object to validate
      Parameters:
      beanType - the bean type
      propertyName - property to validate
      value - property value to validate
      context - The context
      Returns:
      constraint violations or an empty set if none
    • validatedAnnotatedElement

      @NonNull public @NonNull Set<String> validatedAnnotatedElement(@NonNull @NonNull io.micronaut.core.annotation.AnnotatedElement element, @Nullable @Nullable Object value)
      Specified by:
      validatedAnnotatedElement in interface io.micronaut.inject.annotation.AnnotatedElementValidator
    • createValid

      @NonNull public <T> T createValid(@NonNull @NonNull Class<T> beanType, Object... arguments) throws jakarta.validation.ConstraintViolationException
      Description copied from interface: ExecutableMethodValidator
      Create a new valid instance.
      Specified by:
      createValid in interface ExecutableMethodValidator
      Type Parameters:
      T - the generic type
      Parameters:
      beanType - The type
      arguments - The arguments
      Returns:
      The instance
      Throws:
      jakarta.validation.ConstraintViolationException - If a valid instance couldn't be constructed
    • getConstraintsForClass

      public jakarta.validation.metadata.BeanDescriptor getConstraintsForClass(Class<?> clazz)
      Specified by:
      getConstraintsForClass in interface jakarta.validation.Validator
    • unwrap

      public <T> T unwrap(Class<T> type)
      Specified by:
      unwrap in interface jakarta.validation.Validator
    • forExecutables

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

      @NonNull public <T> @NonNull Set<jakarta.validation.ConstraintViolation<T>> validateParameters(@NonNull T object, @NonNull @NonNull io.micronaut.inject.ExecutableMethod method, @NonNull @NonNull Object[] parameterValues, @NonNull @NonNull Class<?>... groups)
      Description copied from interface: ExecutableMethodValidator
      Validate the parameter values of the given ExecutableMethod.
      Specified by:
      validateParameters in interface ExecutableMethodValidator
      Type Parameters:
      T - The object type
      Parameters:
      object - The object
      method - The method
      parameterValues - The values
      groups - The groups
      Returns:
      The constraint violations.
    • validateParameters

      public <T> Set<jakarta.validation.ConstraintViolation<T>> validateParameters(T object, io.micronaut.inject.ExecutableMethod method, @NonNull @NonNull Object[] parameterValues, BeanValidationContext validationContext)
      Description copied from interface: ExecutableMethodValidator
      Validate the parameter values of the given ExecutableMethod.
      Specified by:
      validateParameters in interface ExecutableMethodValidator
      Type Parameters:
      T - The object type
      Parameters:
      object - The object
      method - The method
      parameterValues - The values
      validationContext - The context
      Returns:
      The constraint violations.
    • validateParameters

      @NonNull public <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, @NonNull @NonNull Class<?>... groups)
      Description copied from interface: ExecutableMethodValidator
      Validate the parameter values of the given ExecutableMethod.
      Specified by:
      validateParameters in interface ExecutableMethodValidator
      Type Parameters:
      T - The object type
      Parameters:
      object - The object
      method - The method
      argumentValues - The values
      groups - The groups
      Returns:
      The constraint violations.
    • validateParameters

      @NonNull public <T> @NonNull Set<jakarta.validation.ConstraintViolation<T>> validateParameters(@NonNull T object, @NonNull @NonNull Method method, @NonNull @NonNull Object[] parameterValues, @NonNull @NonNull Class<?>... groups)
      Specified by:
      validateParameters in interface ExecutableMethodValidator
      Specified by:
      validateParameters in interface jakarta.validation.executable.ExecutableValidator
    • validateReturnValue

      @NonNull public <T> @NonNull Set<jakarta.validation.ConstraintViolation<T>> validateReturnValue(@NonNull T object, @NonNull @NonNull Method method, @Nullable @Nullable Object returnValue, @NonNull @NonNull Class<?>... groups)
      Specified by:
      validateReturnValue in interface ExecutableMethodValidator
      Specified by:
      validateReturnValue in interface jakarta.validation.executable.ExecutableValidator
    • validateReturnValue

      @NonNull public <T> @NonNull Set<jakarta.validation.ConstraintViolation<T>> validateReturnValue(@NonNull T bean, @NonNull @NonNull io.micronaut.inject.ExecutableMethod<?,Object> executableMethod, @Nullable @Nullable Object returnValue, @NonNull @NonNull Class<?>... groups)
      Description copied from interface: ExecutableMethodValidator
      Validates the return value of a ExecutableMethod.
      Specified by:
      validateReturnValue in interface ExecutableMethodValidator
      Type Parameters:
      T - The object type
      Parameters:
      bean - The object
      executableMethod - The method
      returnValue - The return value
      groups - The groups
      Returns:
      A set of contstraint violations
    • validateReturnValue

      public <T> Set<jakarta.validation.ConstraintViolation<T>> validateReturnValue(T bean, io.micronaut.inject.ExecutableMethod<?,Object> executableMethod, Object returnValue, BeanValidationContext validationContext)
      Description copied from interface: ExecutableMethodValidator
      Validates the return value of a ExecutableMethod.
      Specified by:
      validateReturnValue in interface ExecutableMethodValidator
      Type Parameters:
      T - The object type
      Parameters:
      bean - The object
      executableMethod - The method
      returnValue - The return value
      validationContext - The validation context
      Returns:
      A set of contstraint violations
    • validateConstructorParameters

      @NonNull public <T> @NonNull Set<jakarta.validation.ConstraintViolation<T>> validateConstructorParameters(@NonNull @NonNull Constructor<? extends T> constructor, @NonNull @NonNull Object[] parameterValues, @NonNull @NonNull Class<?>... groups)
      Specified by:
      validateConstructorParameters in interface ExecutableMethodValidator
      Specified by:
      validateConstructorParameters in interface jakarta.validation.executable.ExecutableValidator
    • validateConstructorParameters

      @NonNull public <T> @NonNull Set<jakarta.validation.ConstraintViolation<T>> validateConstructorParameters(@NonNull @NonNull io.micronaut.core.beans.BeanIntrospection<? extends T> introspection, @NonNull @NonNull Object[] parameterValues, @NonNull @NonNull Class<?>... groups)
      Description copied from interface: ExecutableMethodValidator
      Validates parameters for the given introspection and values.
      Specified by:
      validateConstructorParameters in interface ExecutableMethodValidator
      Type Parameters:
      T - The bean type.
      Parameters:
      introspection - The introspection
      parameterValues - The parameter values
      groups - The groups
      Returns:
      The constraint violations
    • validateConstructorParameters

      public <T> Set<jakarta.validation.ConstraintViolation<T>> validateConstructorParameters(Class<? extends T> beanType, io.micronaut.core.type.Argument<?>[] constructorArguments, @NonNull @NonNull Object[] parameterValues, @NonNull @NonNull Class<?>[] groups)
      Description copied from interface: ExecutableMethodValidator
      Validates arguments for the given bean type and constructor arguments.
      Specified by:
      validateConstructorParameters in interface ExecutableMethodValidator
      Type Parameters:
      T - The generic type of the bean
      Parameters:
      beanType - The bean type
      constructorArguments - The constructor arguments
      parameterValues - The parameter values
      groups - The validation groups
      Returns:
      A set of constraint violations, if any
    • validateConstructorParameters

      public <T> Set<jakarta.validation.ConstraintViolation<T>> validateConstructorParameters(Class<? extends T> beanType, @NonNull @NonNull io.micronaut.core.type.Argument<?>[] constructorArguments, @NonNull @NonNull Object[] parameterValues, BeanValidationContext validationContext)
      Description copied from interface: ExecutableMethodValidator
      Validates arguments for the given bean type and constructor arguments.
      Specified by:
      validateConstructorParameters in interface ExecutableMethodValidator
      Type Parameters:
      T - The generic type of the bean
      Parameters:
      beanType - The bean type
      constructorArguments - The constructor arguments
      parameterValues - The parameter values
      validationContext - The validation context
      Returns:
      A set of constraint violations, if any
    • validateConstructorReturnValue

      @NonNull public <T> @NonNull Set<jakarta.validation.ConstraintViolation<T>> validateConstructorReturnValue(@NonNull @NonNull Constructor<? extends T> constructor, @NonNull T createdObject, @NonNull @NonNull Class<?>... groups)
      Specified by:
      validateConstructorReturnValue in interface ExecutableMethodValidator
      Specified by:
      validateConstructorReturnValue in interface jakarta.validation.executable.ExecutableValidator
    • validatePublisher

      @NonNull public <T> @NonNull org.reactivestreams.Publisher<T> validatePublisher(@NonNull @NonNull io.micronaut.core.type.ReturnType<?> returnType, @NonNull @NonNull org.reactivestreams.Publisher<T> publisher, @NonNull @NonNull Class<?>... groups)
      Description copied from interface: ReactiveValidator
      Validate the given publisher by returning a new Publisher that validates each emitted value. If a constraint violation error occurs a ConstraintViolationException will be thrown.
      Specified by:
      validatePublisher in interface ReactiveValidator
      Type Parameters:
      T - The generic type
      Parameters:
      returnType - The required type of publisher
      publisher - The publisher
      groups - The groups
      Returns:
      The publisher
    • validateCompletionStage

      @NonNull public <T> @NonNull CompletionStage<T> validateCompletionStage(@NonNull @NonNull CompletionStage<T> completionStage, @NonNull @NonNull io.micronaut.core.type.Argument<T> argument, @NonNull @NonNull Class<?>... groups)
      Description copied from interface: ReactiveValidator
      Validate the given CompletionStage by returning a new CompletionStage that validates the emitted value. If a constraint violation error occurs a ConstraintViolationException will be thrown.
      Specified by:
      validateCompletionStage in interface ReactiveValidator
      Type Parameters:
      T - The generic type
      Parameters:
      completionStage - The completion stage
      argument - The completion stage element argument
      groups - The groups
      Returns:
      The publisher
    • validateBeanArgument

      public <T> void validateBeanArgument(@NonNull @NonNull io.micronaut.context.BeanResolutionContext resolutionContext, @NonNull @NonNull io.micronaut.inject.InjectionPoint injectionPoint, @NonNull @NonNull io.micronaut.core.type.Argument<T> argument, int index, @Nullable T value) throws io.micronaut.context.exceptions.BeanInstantiationException
      Specified by:
      validateBeanArgument in interface io.micronaut.inject.validation.BeanDefinitionValidator
      Throws:
      io.micronaut.context.exceptions.BeanInstantiationException
    • 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 interface io.micronaut.inject.validation.BeanDefinitionValidator
      Throws:
      io.micronaut.context.exceptions.BeanInstantiationException
    • getBeanIntrospection

      @Nullable protected <T> @Nullable io.micronaut.core.beans.BeanIntrospection<T> getBeanIntrospection(@NonNull T object, @NonNull @NonNull Class<T> definedClass)
      looks up a bean introspection for the given object by instance's class or defined class.
      Type Parameters:
      T - The introspection type
      Parameters:
      object - The object, never null
      definedClass - The defined class of the object, never null
      Returns:
      The introspection or null
    • getBeanIntrospection

      @Nullable protected <T> @Nullable io.micronaut.core.beans.BeanIntrospection<T> getBeanIntrospection(@NonNull T object)
      Looks up a bean introspection for the given object.
      Type Parameters:
      T - The introspection type
      Parameters:
      object - The object, never null
      Returns:
      The introspection or null
    • getBeanIntrospection

      @Nullable protected <T> @Nullable io.micronaut.core.beans.BeanIntrospection<T> getBeanIntrospection(@NonNull @NonNull Class<T> type)
      Looks up a bean introspection for the given object.
      Type Parameters:
      T - The introspection type
      Parameters:
      type - The object type
      Returns:
      The introspection or null
    • requireNonNull

      @Deprecated(since="4.3.0") public static <T> T requireNonNull(String name, T value)
      Deprecated.
      It will be private in a future version.
      Throws a IllegalArgumentException if the value is null.
      Type Parameters:
      T - value Type
      Parameters:
      name - check name
      value - value being checked
      Returns:
      the value
    • requireNonEmpty

      @Deprecated(since="4.3.0") public static String requireNonEmpty(String name, String value)
      Deprecated.
      It will be private in a future version.
      Throws a IllegalArgumentException if the value null or an empty string.
      Parameters:
      name - check name
      value - value being checked
      Returns:
      the value