Class OneofEvaluator
java.lang.Object
build.buf.protovalidate.internal.evaluator.OneofEvaluator
- All Implemented Interfaces:
Evaluator
OneofEvaluator performs validation on a oneof union.-
Constructor Summary
ConstructorsConstructorDescriptionOneofEvaluator(com.google.protobuf.Descriptors.OneofDescriptor descriptor, boolean required) Constructs aOneofEvaluator. -
Method Summary
Modifier and TypeMethodDescriptionChecks that the provided val is valid.booleanTautology returns true if the evaluator always succeeds.
-
Constructor Details
-
OneofEvaluator
public OneofEvaluator(com.google.protobuf.Descriptors.OneofDescriptor descriptor, boolean required) Constructs aOneofEvaluator.- 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:EvaluatorTautology returns true if the evaluator always succeeds. -
evaluate
Description copied from interface:EvaluatorChecks that the provided val is valid. Unless failFast is true, evaluation attempts to find allViolationspresent in val instead of returning aValidationResulton the firstViolation.- Specified by:
evaluatein interfaceEvaluator- 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.
-