Class CelRuntimeImpl.Builder
- java.lang.Object
-
- dev.cel.runtime.CelRuntimeImpl.Builder
-
- All Implemented Interfaces:
CelRuntimeBuilder
- Enclosing class:
- CelRuntimeImpl
public abstract static class CelRuntimeImpl.Builder extends java.lang.Object implements CelRuntimeBuilder
Builder forCelRuntimeImpl.
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description CelRuntimeImpl.BuilderaddFileTypes(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.CelRuntimeImpl.BuilderaddFileTypes(com.google.protobuf.Descriptors.FileDescriptor... fileDescriptors)AddDescriptors.FileDescriptors to the use for type-checking, and for object creation at interpretation time.CelRuntimeImpl.BuilderaddFileTypes(java.lang.Iterable<com.google.protobuf.Descriptors.FileDescriptor> fileDescriptors)AddDescriptors.FileDescriptors to the use for type-checking, and for object creation at interpretation time.CelRuntimeImpl.BuilderaddFunctionBindings(CelFunctionBinding... bindings)Add one or moreCelFunctionBindingobjects to the CEL runtime.CelRuntimeImpl.BuilderaddFunctionBindings(java.lang.Iterable<CelFunctionBinding> bindings)Bind a collection ofCelFunctionBindingobjects to the runtime.CelRuntimeImpl.BuilderaddLateBoundFunctions(java.lang.Iterable<java.lang.String> lateBoundFunctionNames)Adds bindings for functions that are allowed to be late-bound (resolved at execution time).CelRuntimeImpl.BuilderaddLateBoundFunctions(java.lang.String... lateBoundFunctionNames)Adds bindings for functions that are allowed to be late-bound (resolved at execution time).CelRuntimeImpl.BuilderaddLibraries(CelRuntimeLibrary... libraries)Adds one or more libraries for runtime.CelRuntimeImpl.BuilderaddLibraries(java.lang.Iterable<? extends CelRuntimeLibrary> libraries)Adds a collection of libraries for runtime.CelRuntimeImpl.BuilderaddMessageTypes(com.google.protobuf.Descriptors.Descriptor... descriptors)Add messageDescriptors.Descriptors to the builder for type-checking and object creation at interpretation time.CelRuntimeImpl.BuilderaddMessageTypes(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.abstract CelRuntimeImpl.BuildersetContainer(dev.cel.common.CelContainer container)Set theCelContainerto use as the namespace for resolving CEL expression variables and functions.abstract CelRuntimeImpl.BuildersetExtensionRegistry(com.google.protobuf.ExtensionRegistry extensionRegistry)Sets a proto ExtensionRegistry to assist with unpacking Any messages containing a proto2 extension field.abstract CelRuntimeImpl.BuildersetOptions(dev.cel.common.CelOptions options)Set theCelOptionsused to enable fixes and features for this CEL instance.abstract CelRuntimeImpl.BuildersetPlanner(ProgramPlanner planner)CelRuntimeImpl.BuildersetStandardEnvironmentEnabled(boolean value)Enable or disable the standard CEL library functions and variables.abstract CelRuntimeImpl.BuildersetStandardFunctions(CelStandardFunctions standardFunctions)Override the standard functions for the runtime.CelRuntimeImpl.BuildersetTypeFactory(java.util.function.Function<java.lang.String,com.google.protobuf.Message.Builder> typeFactory)Set a custom type factory for the runtime.abstract CelRuntimeImpl.BuildersetTypeProvider(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.abstract CelRuntimeImpl.BuildersetValueProvider(CelValueProvider celValueProvider)Sets theCelValueProviderfor resolving struct values during evaluation.
-
-
-
Method Detail
-
setPlanner
public abstract CelRuntimeImpl.Builder setPlanner(ProgramPlanner planner)
-
setOptions
public abstract CelRuntimeImpl.Builder setOptions(dev.cel.common.CelOptions options)
Description copied from interface:CelRuntimeBuilderSet theCelOptionsused to enable fixes and features for this CEL instance.- Specified by:
setOptionsin interfaceCelRuntimeBuilder
-
setStandardFunctions
public abstract CelRuntimeImpl.Builder setStandardFunctions(CelStandardFunctions standardFunctions)
Description copied from interface:CelRuntimeBuilderOverride 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.CelRuntimeBuilder.setStandardEnvironmentEnabled(boolean)must be set to false for this to take effect.- Specified by:
setStandardFunctionsin interfaceCelRuntimeBuilder
-
setExtensionRegistry
public abstract CelRuntimeImpl.Builder setExtensionRegistry(com.google.protobuf.ExtensionRegistry extensionRegistry)
Description copied from interface:CelRuntimeBuilderSets a proto ExtensionRegistry to assist with unpacking Any messages containing a proto2 extension field.- Specified by:
setExtensionRegistryin interfaceCelRuntimeBuilder
-
setTypeProvider
public abstract CelRuntimeImpl.Builder setTypeProvider(dev.cel.common.types.CelTypeProvider celTypeProvider)
Description copied from interface:CelRuntimeBuilderSets theCelTypeProviderfor resolving CEL types during evaluation, such as a fully qualified type name to a struct or an enum value.- Specified by:
setTypeProviderin interfaceCelRuntimeBuilder
-
setValueProvider
public abstract CelRuntimeImpl.Builder setValueProvider(CelValueProvider celValueProvider)
Description copied from interface:CelRuntimeBuilderSets 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.
- Specified by:
setValueProviderin interfaceCelRuntimeBuilder
-
setContainer
public abstract CelRuntimeImpl.Builder setContainer(dev.cel.common.CelContainer container)
Description copied from interface:CelRuntimeBuilderSet theCelContainerto use as the namespace for resolving CEL expression variables and functions.- Specified by:
setContainerin interfaceCelRuntimeBuilder
-
addFunctionBindings
@CanIgnoreReturnValue public CelRuntimeImpl.Builder addFunctionBindings(CelFunctionBinding... bindings)
Description copied from interface:CelRuntimeBuilderAdd one or moreCelFunctionBindingobjects to the CEL runtime.Functions with duplicate overload ids will be replaced in favor of the new overload.
- Specified by:
addFunctionBindingsin interfaceCelRuntimeBuilder
-
addFunctionBindings
@CanIgnoreReturnValue public CelRuntimeImpl.Builder addFunctionBindings(java.lang.Iterable<CelFunctionBinding> bindings)
Description copied from interface:CelRuntimeBuilderBind a collection ofCelFunctionBindingobjects to the runtime.Functions with duplicate overload ids will be replaced in favor of the new overload.
- Specified by:
addFunctionBindingsin interfaceCelRuntimeBuilder
-
addLateBoundFunctions
@CanIgnoreReturnValue public CelRuntimeImpl.Builder addLateBoundFunctions(java.lang.String... lateBoundFunctionNames)
Description copied from interface:CelRuntimeBuilderAdds bindings for functions that are allowed to be late-bound (resolved at execution time).- Specified by:
addLateBoundFunctionsin interfaceCelRuntimeBuilder
-
addLateBoundFunctions
@CanIgnoreReturnValue public CelRuntimeImpl.Builder addLateBoundFunctions(java.lang.Iterable<java.lang.String> lateBoundFunctionNames)
Description copied from interface:CelRuntimeBuilderAdds bindings for functions that are allowed to be late-bound (resolved at execution time).- Specified by:
addLateBoundFunctionsin interfaceCelRuntimeBuilder
-
addMessageTypes
@CanIgnoreReturnValue public CelRuntimeImpl.Builder addMessageTypes(com.google.protobuf.Descriptors.Descriptor... descriptors)
Description copied from interface:CelRuntimeBuilderAdd 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 (
CelRuntimeBuilder.setTypeFactory(java.util.function.Function<java.lang.String, com.google.protobuf.Message.Builder>)) Custom descriptor set {#addMessageTypes)- Specified by:
addMessageTypesin interfaceCelRuntimeBuilder
-
addMessageTypes
@CanIgnoreReturnValue public CelRuntimeImpl.Builder addMessageTypes(java.lang.Iterable<com.google.protobuf.Descriptors.Descriptor> descriptors)
Description copied from interface:CelRuntimeBuilderAdd 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 (
CelRuntimeBuilder.setTypeFactory(java.util.function.Function<java.lang.String, com.google.protobuf.Message.Builder>)) Custom descriptor set {#addMessageTypes)- Specified by:
addMessageTypesin interfaceCelRuntimeBuilder
-
addFileTypes
@CanIgnoreReturnValue public CelRuntimeImpl.Builder addFileTypes(com.google.protobuf.DescriptorProtos.FileDescriptorSet fileDescriptorSet)
Description copied from interface:CelRuntimeBuilderAdd 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:
- Specified by:
addFileTypesin interfaceCelRuntimeBuilder
-
addFileTypes
@CanIgnoreReturnValue public CelRuntimeImpl.Builder addFileTypes(com.google.protobuf.Descriptors.FileDescriptor... fileDescriptors)
Description copied from interface:CelRuntimeBuilderAddDescriptors.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:
- Specified by:
addFileTypesin interfaceCelRuntimeBuilder
-
addFileTypes
@CanIgnoreReturnValue public CelRuntimeImpl.Builder addFileTypes(java.lang.Iterable<com.google.protobuf.Descriptors.FileDescriptor> fileDescriptors)
Description copied from interface:CelRuntimeBuilderAddDescriptors.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:
- Specified by:
addFileTypesin interfaceCelRuntimeBuilder
-
addLibraries
@CanIgnoreReturnValue public CelRuntimeImpl.Builder addLibraries(CelRuntimeLibrary... libraries)
Description copied from interface:CelRuntimeBuilderAdds one or more libraries for runtime.- Specified by:
addLibrariesin interfaceCelRuntimeBuilder
-
addLibraries
@CanIgnoreReturnValue public CelRuntimeImpl.Builder addLibraries(java.lang.Iterable<? extends CelRuntimeLibrary> libraries)
Description copied from interface:CelRuntimeBuilderAdds a collection of libraries for runtime.- Specified by:
addLibrariesin interfaceCelRuntimeBuilder
-
setTypeFactory
public CelRuntimeImpl.Builder setTypeFactory(java.util.function.Function<java.lang.String,com.google.protobuf.Message.Builder> typeFactory)
Description copied from interface:CelRuntimeBuilderSet 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 {CelRuntimeBuilder.addMessageTypes(com.google.protobuf.Descriptors.Descriptor...))- Specified by:
setTypeFactoryin interfaceCelRuntimeBuilder
-
setStandardEnvironmentEnabled
public CelRuntimeImpl.Builder setStandardEnvironmentEnabled(boolean value)
Description copied from interface:CelRuntimeBuilderEnable or disable the standard CEL library functions and variables.- Specified by:
setStandardEnvironmentEnabledin interfaceCelRuntimeBuilder
-
build
public CelRuntime build()
Description copied from interface:CelRuntimeBuilderBuild a new instance of theCelRuntime.- Specified by:
buildin interfaceCelRuntimeBuilder
-
-