Class ConstraintCache
java.lang.Object
build.buf.protovalidate.internal.constraints.ConstraintCache
A build-through cache for computed standard constraints.
-
Constructor Summary
ConstructorsConstructorDescriptionConstraintCache(org.projectnessie.cel.Env env) Constructs a new build-through cache for the standard constraints. -
Method Summary
Modifier and TypeMethodDescriptioncompile(com.google.protobuf.Descriptors.FieldDescriptor fieldDescriptor, FieldConstraints fieldConstraints, boolean forItems) Creates the standard constraints for the given field.
-
Constructor Details
-
ConstraintCache
public ConstraintCache(org.projectnessie.cel.Env env) Constructs a new build-through cache for the standard constraints.- Parameters:
env- The CEL environment for evaluation.
-
-
Method Details
-
compile
public List<CompiledProgram> compile(com.google.protobuf.Descriptors.FieldDescriptor fieldDescriptor, FieldConstraints fieldConstraints, boolean forItems) throws CompilationException Creates the standard constraints for the given field. If forItems is true, the constraints for repeated list items is built instead of the constraints on the list itself.- Parameters:
fieldDescriptor- The field descriptor to be validated.fieldConstraints- The field constraint that is used for validation.forItems- The field is an item list type.- Returns:
- The list of compiled programs.
- Throws:
CompilationException- If the constraints fail to compile.
-