Interface CelRuntimeBuilder
-
- All Known Implementing Classes:
CelRuntimeImpl.Builder,CelRuntimeLegacyImpl.Builder
public interface CelRuntimeBuilderInterface for building an instance of CelRuntime
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description CelRuntimeBuilderaddFileTypes(com.google.protobuf.DescriptorProtos.FileDescriptorSet fileDescriptorSet)Add all of theDescriptors.FileDescriptors in aFileDescriptorSetto the use for type-checking, and for object creation at interpretation time.CelRuntimeBuilderaddFileTypes(com.google.protobuf.Descriptors.FileDescriptor... fileDescriptors)AddDescriptors.FileDescriptors to the use for type-checking, and for object creation at interpretation time.CelRuntimeBuilderaddFileTypes(java.lang.Iterable<com.google.protobuf.Descriptors.FileDescriptor> fileDescriptors)AddDescriptors.FileDescriptors to the use for type-checking, and for object creation at interpretation time.CelRuntimeBuilderaddFunctionBindings(CelFunctionBinding... bindings)Add one or moreCelFunctionBindingobjects to the CEL runtime.CelRuntimeBuilderaddFunctionBindings(java.lang.Iterable<CelFunctionBinding> bindings)Bind a collection ofCelFunctionBindingobjects to the runtime.CelRuntimeBuilderaddLateBoundFunctions(java.lang.Iterable<java.lang.String> lateBoundFunctionNames)Adds bindings for functions that are allowed to be late-bound (resolved at execution time).CelRuntimeBuilderaddLateBoundFunctions(java.lang.String... lateBoundFunctionNames)Adds bindings for functions that are allowed to be late-bound (resolved at execution time).CelRuntimeBuilderaddLibraries(CelRuntimeLibrary... libraries)Adds one or more libraries for runtime.CelRuntimeBuilderaddLibraries(java.lang.Iterable<? extends CelRuntimeLibrary> libraries)Adds a collection of libraries for runtime.CelRuntimeBuilderaddMessageTypes(com.google.protobuf.Descriptors.Descriptor... descriptors)Add messageDescriptors.Descriptors to the builder for type-checking and object creation at interpretation time.CelRuntimeBuilderaddMessageTypes(java.lang.Iterable<com.google.protobuf.Descriptors.Descriptor> descriptors)Add messageDescriptors.Descriptors to the use for type-checking and object creation at interpretation time.CelRuntimebuild()Build a new instance of theCelRuntime.CelRuntimeBuildersetContainer(dev.cel.common.CelContainer container)Set theCelContainerto use as the namespace for resolving CEL expression variables and functions.CelRuntimeBuildersetExtensionRegistry(com.google.protobuf.ExtensionRegistry extensionRegistry)Sets a proto ExtensionRegistry to assist with unpacking Any messages containing a proto2 extension field.CelRuntimeBuildersetOptions(dev.cel.common.CelOptions options)Set theCelOptionsused to enable fixes and features for this CEL instance.CelRuntimeBuildersetStandardEnvironmentEnabled(boolean value)Enable or disable the standard CEL library functions and variables.CelRuntimeBuildersetStandardFunctions(CelStandardFunctions standardFunctions)Override the standard functions for the runtime.CelRuntimeBuildersetTypeFactory(java.util.function.Function<java.lang.String,com.google.protobuf.Message.Builder> typeFactory)Set a custom type factory for the runtime.CelRuntimeBuildersetTypeProvider(dev.cel.common.types.CelTypeProvider celTypeProvider)Sets theCelTypeProviderfor resolving CEL types during evaluation, such as a fully qualified type name to a struct or an enum value.CelRuntimeBuildersetValueProvider(CelValueProvider celValueProvider)Sets theCelValueProviderfor resolving struct values during evaluation.
-
-
-
Method Detail
-
setOptions
@CanIgnoreReturnValue CelRuntimeBuilder setOptions(dev.cel.common.CelOptions options)
Set theCelOptionsused to enable fixes and features for this CEL instance.
-
addFunctionBindings
@CanIgnoreReturnValue CelRuntimeBuilder addFunctionBindings(CelFunctionBinding... bindings)
Add one or moreCelFunctionBindingobjects to the CEL runtime.Functions with duplicate overload ids will be replaced in favor of the new overload.
-
addFunctionBindings
@CanIgnoreReturnValue CelRuntimeBuilder addFunctionBindings(java.lang.Iterable<CelFunctionBinding> bindings)
Bind a collection ofCelFunctionBindingobjects to the runtime.Functions with duplicate overload ids will be replaced in favor of the new overload.
-
addLateBoundFunctions
@CanIgnoreReturnValue CelRuntimeBuilder addLateBoundFunctions(java.lang.String... lateBoundFunctionNames)
Adds bindings for functions that are allowed to be late-bound (resolved at execution time).
-
addLateBoundFunctions
@CanIgnoreReturnValue CelRuntimeBuilder addLateBoundFunctions(java.lang.Iterable<java.lang.String> lateBoundFunctionNames)
Adds bindings for functions that are allowed to be late-bound (resolved at execution time).
-
addMessageTypes
@CanIgnoreReturnValue CelRuntimeBuilder addMessageTypes(com.google.protobuf.Descriptors.Descriptor... descriptors)
Add messageDescriptors.Descriptors to the builder for type-checking and object creation at interpretation time.Note, it is valid to combine type factory methods within the runtime. Only the options which have been configured will be used. The type creation search order is as follows:
-
Custom type factory (
setTypeFactory(java.util.function.Function<java.lang.String, com.google.protobuf.Message.Builder>)) Custom descriptor set {#addMessageTypes)
-
addMessageTypes
@CanIgnoreReturnValue CelRuntimeBuilder addMessageTypes(java.lang.Iterable<com.google.protobuf.Descriptors.Descriptor> descriptors)
Add messageDescriptors.Descriptors to the use for type-checking and object creation at interpretation time.Note, it is valid to combine type factory methods within the runtime. Only the options which have been configured will be used. The type creation search order is as follows:
-
Custom type factory (
setTypeFactory(java.util.function.Function<java.lang.String, com.google.protobuf.Message.Builder>)) Custom descriptor set {#addMessageTypes)
-
addFileTypes
@CanIgnoreReturnValue CelRuntimeBuilder addFileTypes(com.google.protobuf.Descriptors.FileDescriptor... fileDescriptors)
AddDescriptors.FileDescriptors to the use for type-checking, and for object creation at interpretation time.Note, it is valid to combine type factory methods within the runtime. Only the options which have been configured will be used. The type creation search order is as follows:
-
Custom type factory (
setTypeFactory(java.util.function.Function<java.lang.String, com.google.protobuf.Message.Builder>)) Custom descriptor set {addMessageTypes(com.google.protobuf.Descriptors.Descriptor...))
-
addFileTypes
@CanIgnoreReturnValue CelRuntimeBuilder addFileTypes(java.lang.Iterable<com.google.protobuf.Descriptors.FileDescriptor> fileDescriptors)
AddDescriptors.FileDescriptors to the use for type-checking, and for object creation at interpretation time.Note, it is valid to combine type factory methods within the runtime. Only the options which have been configured will be used. The type creation search order is as follows:
-
Custom type factory (
setTypeFactory(java.util.function.Function<java.lang.String, com.google.protobuf.Message.Builder>)) Custom descriptor set {addMessageTypes(com.google.protobuf.Descriptors.Descriptor...))
-
addFileTypes
@CanIgnoreReturnValue CelRuntimeBuilder addFileTypes(com.google.protobuf.DescriptorProtos.FileDescriptorSet fileDescriptorSet)
Add all of theDescriptors.FileDescriptors in aFileDescriptorSetto the use for type-checking, and for object creation at interpretation time.Note, it is valid to combine type factory methods within the runtime. Only the options which have been configured will be used. The type creation search order is as follows:
-
Custom type factory (
setTypeFactory(java.util.function.Function<java.lang.String, com.google.protobuf.Message.Builder>)) Custom descriptor set {addMessageTypes(com.google.protobuf.Descriptors.Descriptor...))
-
setTypeProvider
@CanIgnoreReturnValue CelRuntimeBuilder setTypeProvider(dev.cel.common.types.CelTypeProvider celTypeProvider)
Sets theCelTypeProviderfor resolving CEL types during evaluation, such as a fully qualified type name to a struct or an enum value.
-
setTypeFactory
@CanIgnoreReturnValue CelRuntimeBuilder setTypeFactory(java.util.function.Function<java.lang.String,com.google.protobuf.Message.Builder> typeFactory)
Set a custom type factory for the runtime.Note: it is valid to combine type factory methods within the runtime. Only the options which have been configured will be used.
The type creation search order is as follows:
-
Custom type factory (
#setTypeFactory) Custom descriptor set {addMessageTypes(com.google.protobuf.Descriptors.Descriptor...))
-
setValueProvider
@CanIgnoreReturnValue CelRuntimeBuilder setValueProvider(CelValueProvider celValueProvider)
Sets theCelValueProviderfor resolving struct values during evaluation. Multiple providers can be combined usingCombinedCelValueProvider. Note that if you intend to support proto messages in addition to custom struct values, protobuf value provider must be configured first before the custom value provider.Note that this option is only supported for planner-based runtime.
-
setStandardEnvironmentEnabled
@CanIgnoreReturnValue CelRuntimeBuilder setStandardEnvironmentEnabled(boolean value)
Enable or disable the standard CEL library functions and variables.
-
setStandardFunctions
@CanIgnoreReturnValue CelRuntimeBuilder setStandardFunctions(CelStandardFunctions standardFunctions)
Override the standard functions for the runtime. This can be used to subset the standard environment to only expose the desired function overloads to the runtime.setStandardEnvironmentEnabled(boolean)must be set to false for this to take effect.
-
addLibraries
@CanIgnoreReturnValue CelRuntimeBuilder addLibraries(CelRuntimeLibrary... libraries)
Adds one or more libraries for runtime.
-
addLibraries
@CanIgnoreReturnValue CelRuntimeBuilder addLibraries(java.lang.Iterable<? extends CelRuntimeLibrary> libraries)
Adds a collection of libraries for runtime.
-
setExtensionRegistry
@CanIgnoreReturnValue CelRuntimeBuilder setExtensionRegistry(com.google.protobuf.ExtensionRegistry extensionRegistry)
Sets a proto ExtensionRegistry to assist with unpacking Any messages containing a proto2 extension field.
-
setContainer
@CanIgnoreReturnValue CelRuntimeBuilder setContainer(dev.cel.common.CelContainer container)
Set theCelContainerto use as the namespace for resolving CEL expression variables and functions.
-
build
@CheckReturnValue CelRuntime build()
Build a new instance of theCelRuntime.
-
-