Class DefaultConstraintValidatorContext<R>

java.lang.Object
io.micronaut.validation.validator.DefaultConstraintValidatorContext<R>
Type Parameters:
R - The root bean type
All Implemented Interfaces:
ConstraintValidatorContext, jakarta.validation.ConstraintValidatorContext

@Internal public final class DefaultConstraintValidatorContext<R> extends Object implements ConstraintValidatorContext
The implementation of ConstraintValidatorContext.
  • Method Details

    • getValidationContext

      @NonNull public @NonNull BeanValidationContext getValidationContext()
      The validation context.
      Returns:
      The context
    • hasDefaultGroup

      public boolean hasDefaultGroup()
    • containsGroup

      public boolean containsGroup(Collection<Class<?>> constraintGroups)
    • getExecutableParameterValues

      public Object[] getExecutableParameterValues()
    • getExecutableReturnValue

      public Object getExecutableReturnValue()
    • isValidated

      public boolean isValidated(Object obj)
    • validating

      public io.micronaut.validation.validator.DefaultConstraintValidatorContext.ValidationCloseable validating(Object obj)
    • withExecutableParameterValues

      public io.micronaut.validation.validator.DefaultConstraintValidatorContext.ValidationCloseable withExecutableParameterValues(Object[] executableParameterValues)
    • withExecutableReturnValue

      public io.micronaut.validation.validator.DefaultConstraintValidatorContext.ValidationCloseable withExecutableReturnValue(Object executableReturnValue)
    • withGroupSequence

      public io.micronaut.validation.validator.DefaultConstraintValidatorContext.GroupsValidation withGroupSequence(@NonNull @NonNull io.micronaut.validation.validator.DefaultConstraintValidatorContext.ValidationGroup validationGroup)
    • convertGroups

      public io.micronaut.validation.validator.DefaultConstraintValidatorContext.ValidationCloseable convertGroups(@NonNull @NonNull io.micronaut.core.annotation.AnnotationMetadata annotationMetadata)
    • findGroupSequences

      public List<io.micronaut.validation.validator.DefaultConstraintValidatorContext.ValidationGroup> findGroupSequences(io.micronaut.core.beans.BeanIntrospection<?> beanIntrospection)
    • findGroupSequences

      public List<io.micronaut.validation.validator.DefaultConstraintValidatorContext.ValidationGroup> findGroupSequences()
    • addViolation

      public void addViolation(io.micronaut.validation.validator.DefaultConstraintViolation<R> violation)
    • getOverallViolations

      public Set<jakarta.validation.ConstraintViolation<R>> getOverallViolations()
    • getCurrentPath

      public io.micronaut.validation.validator.ValidationPath getCurrentPath()
    • getRootBean

      @Nullable public R getRootBean()
      Description copied from interface: ConstraintValidatorContext
      In case of using this constraint validator with jakarta.validation.ConstraintValidator returns null, because JRS-303 doesn't support passing a root bean in their validation context.
      Specified by:
      getRootBean in interface ConstraintValidatorContext
      Returns:
      The root bean under validation.
    • getRootClass

      public Class<R> getRootClass()
    • disableDefaultConstraintViolation

      public void disableDefaultConstraintViolation()
      Specified by:
      disableDefaultConstraintViolation in interface jakarta.validation.ConstraintValidatorContext
    • getDefaultConstraintMessageTemplate

      public String getDefaultConstraintMessageTemplate()
      Specified by:
      getDefaultConstraintMessageTemplate in interface jakarta.validation.ConstraintValidatorContext
    • getClockProvider

      @NonNull public @NonNull jakarta.validation.ClockProvider getClockProvider()
      Description copied from interface: ConstraintValidatorContext
      Returns the provider for obtaining the current time in the form of a Clock, e.g. when validating the Future and Past constraints.
      Specified by:
      getClockProvider in interface ConstraintValidatorContext
      Specified by:
      getClockProvider in interface jakarta.validation.ConstraintValidatorContext
      Returns:
      the provider for obtaining the current time, never null. If no specific provider has been configured during bootstrap, a default implementation using the current system time and the current default time zone as returned by Clock.systemDefaultZone() will be returned.
    • buildConstraintViolationWithTemplate

      public jakarta.validation.ConstraintValidatorContext.ConstraintViolationBuilder buildConstraintViolationWithTemplate(String messageTemplate)
      Specified by:
      buildConstraintViolationWithTemplate in interface jakarta.validation.ConstraintValidatorContext
    • unwrap

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

      public void messageTemplate(@Nullable @Nullable String messageTemplate)
      Description copied from interface: ConstraintValidatorContext
      Sets a message template to be used for the validation error message.
      Specified by:
      messageTemplate in interface ConstraintValidatorContext
      Parameters:
      messageTemplate - the message template