|
22 | 22 | import com.google.protobuf.Descriptors.FileDescriptor;
|
23 | 23 | import com.google.protobuf.ExtensionRegistry;
|
24 | 24 | import com.google.protobuf.Message;
|
| 25 | +import dev.cel.checker.CelStandardDeclarations; |
25 | 26 | import dev.cel.checker.ProtoTypeMask;
|
26 | 27 | import dev.cel.checker.TypeProvider;
|
27 | 28 | import dev.cel.common.CelContainer;
|
|
36 | 37 | import dev.cel.parser.CelStandardMacro;
|
37 | 38 | import dev.cel.runtime.CelFunctionBinding;
|
38 | 39 | import dev.cel.runtime.CelRuntimeLibrary;
|
| 40 | +import dev.cel.runtime.CelStandardFunctions; |
39 | 41 | import java.util.function.Function;
|
40 | 42 |
|
41 | 43 | /** Interface for building an instance of Cel. */
|
@@ -84,7 +86,7 @@ public interface CelBuilder {
|
84 | 86 | /** Retrieves the currently configured {@link CelContainer} in the builder. */
|
85 | 87 | CelContainer container();
|
86 | 88 |
|
87 |
| - /* |
| 89 | + /** |
88 | 90 | * Set the {@link CelContainer} to use as the namespace for resolving CEL expression variables and
|
89 | 91 | * functions.
|
90 | 92 | */
|
@@ -299,6 +301,24 @@ public interface CelBuilder {
|
299 | 301 | @CanIgnoreReturnValue
|
300 | 302 | CelBuilder addRuntimeLibraries(Iterable<CelRuntimeLibrary> libraries);
|
301 | 303 |
|
| 304 | + /** |
| 305 | + * Override the standard declarations for the type-checker. This can be used to subset the |
| 306 | + * standard environment to only expose the desired declarations to the type-checker. {@link |
| 307 | + * #setStandardEnvironmentEnabled(boolean)} must be set to false for this to take effect. |
| 308 | + */ |
| 309 | + @CanIgnoreReturnValue |
| 310 | + CelBuilder setStandardDeclarations(CelStandardDeclarations standardDeclarations); |
| 311 | + |
| 312 | + /** |
| 313 | + * Override the standard functions for the runtime. This can be used to subset the standard |
| 314 | + * environment to only expose the desired function overloads to the runtime. |
| 315 | + * |
| 316 | + * <p>{@link #setStandardEnvironmentEnabled(boolean)} must be set to false for this to take |
| 317 | + * effect. |
| 318 | + */ |
| 319 | + @CanIgnoreReturnValue |
| 320 | + CelBuilder setStandardFunctions(CelStandardFunctions standardFunctions); |
| 321 | + |
302 | 322 | /**
|
303 | 323 | * Sets a proto ExtensionRegistry to assist with unpacking Any messages containing a proto2
|
304 | 324 | extension field.
|
|
0 commit comments