Class ConstraintCache

java.lang.Object
build.buf.protovalidate.internal.constraints.ConstraintCache

public class ConstraintCache extends Object
A build-through cache for computed standard constraints.
  • Constructor Details

    • ConstraintCache

      public ConstraintCache(org.projectnessie.cel.Env env)
      Constructs a new build-through cache for the standard constraints.
  • 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.