Class OneofEvaluator

java.lang.Object
build.buf.protovalidate.internal.evaluator.OneofEvaluator
All Implemented Interfaces:
Evaluator

public class OneofEvaluator extends Object implements Evaluator
OneofEvaluator performs validation on a oneof union.
  • Constructor Details

    • OneofEvaluator

      public OneofEvaluator(com.google.protobuf.Descriptors.OneofDescriptor descriptor, boolean required)
      Constructs a OneofEvaluator.
      Parameters:
      descriptor - The targeted oneof descriptor.
      required - Indicates whether a member of the oneof must be set.
  • Method Details

    • tautology

      public boolean tautology()
      Description copied from interface: Evaluator
      Tautology returns true if the evaluator always succeeds.
      Specified by:
      tautology in interface Evaluator
      Returns:
      True if the evaluator always succeeds.
    • evaluate

      public ValidationResult evaluate(Value val, boolean failFast) throws ExecutionException
      Description copied from interface: Evaluator
      Checks that the provided val is valid. Unless failFast is true, evaluation attempts to find all Violations present in val instead of returning a ValidationResult on the first Violation.
      Specified by:
      evaluate in interface Evaluator
      Parameters:
      val - The value to validate.
      failFast - If true, validation stops after the first failure.
      Returns:
      The result of validation on the specified value.
      Throws:
      ExecutionException - If evaluation fails to complete.