java.lang.Object
io.fluxcapacitor.javaclient.tracking.handling.validation.Jsr380Validator
All Implemented Interfaces:
Validator

public class Jsr380Validator extends Object implements Validator
This validator uses JSR 380 annotations. However, before attempting method and type validations it will first attempt field validations. This strategy prevents issues if one of the validated methods depends on one or more validated fields but those fields are invalid.
  • Constructor Details

    • Jsr380Validator

      public Jsr380Validator()
  • Method Details

    • createDefault

      public static Jsr380Validator createDefault()
    • checkValidity

      public <T> Optional<ValidationException> checkValidity(T object, Class<?>... groups)
      Description copied from interface: Validator
      Validates the given object and returns an optional ValidationException if the object is invalid.
      Specified by:
      checkValidity in interface Validator
      Type Parameters:
      T - the type of object being validated
      Parameters:
      object - the object to validate
      groups - optional validation groups to apply
      Returns:
      an Optional containing the validation error if validation failed, or empty if valid
    • newValidationException

      protected ValidationException newValidationException(Collection<? extends jakarta.validation.ConstraintViolation<?>> violations)
    • format

      protected SortedSet<String> format(Collection<? extends jakarta.validation.ConstraintViolation<?>> violations, boolean fullPath)
    • format

      protected static String format(jakarta.validation.ConstraintViolation<?> v, boolean fullPath)
    • getPropertyPath

      protected static String getPropertyPath(jakarta.validation.ConstraintViolation<?> v, boolean full)