Class ValidationResult

java.lang.Object
build.buf.protovalidate.ValidationResult

public class ValidationResult extends Object
ValidationResult is returned when a constraint is executed. It contains a list of violations. This is non-fatal. If there are no violations, the constraint is considered to have passed.
  • Field Details

    • EMPTY

      public static final ValidationResult EMPTY
      A violation result with an empty violation list.
  • Constructor Details

    • ValidationResult

      public ValidationResult(List<Violation> violations)
      Creates a violation result from a list of violations.
      Parameters:
      violations - violation list for the result.
  • Method Details

    • isSuccess

      public boolean isSuccess()
      Check if the result is successful.
      Returns:
      if the validation result was a success.
    • getViolations

      public List<Violation> getViolations()
      Get the list of violations in the result.
      Returns:
      the violation list.
    • toString

      public String toString()
      Returns a string representation of the validation result, including all the violations.
      Overrides:
      toString in class Object
      Returns:
      a string representation of the validation result.