Class CelRuntimeLegacyImpl.Builder
- java.lang.Object
-
- dev.cel.runtime.CelRuntimeLegacyImpl.Builder
-
- All Implemented Interfaces:
CelRuntimeBuilder
- Enclosing class:
- CelRuntimeLegacyImpl
public static final class CelRuntimeLegacyImpl.Builder extends java.lang.Object implements CelRuntimeBuilder
Builder class forCelRuntimeLegacyImpl.
-
-
Method Summary
All Methods Instance Methods Concrete 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.CelRuntimeLegacyImplbuild()Build a newCelRuntimeLegacyImplinstance from the builder config.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
public CelRuntimeBuilder 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
-
addFunctionBindings
public CelRuntimeBuilder 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
public CelRuntimeBuilder 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
public CelRuntimeBuilder 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
public CelRuntimeBuilder 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
public CelRuntimeBuilder 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
public CelRuntimeBuilder 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
public CelRuntimeBuilder 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
public CelRuntimeBuilder 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
-
addFileTypes
public CelRuntimeBuilder 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
-
setTypeProvider
public CelRuntimeBuilder 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 CelRuntimeBuilder 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
-
setTypeFactory
public CelRuntimeBuilder 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 CelRuntimeBuilder setStandardEnvironmentEnabled(boolean value)
Description copied from interface:CelRuntimeBuilderEnable or disable the standard CEL library functions and variables.- Specified by:
setStandardEnvironmentEnabledin interfaceCelRuntimeBuilder
-
setStandardFunctions
public CelRuntimeBuilder 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
-
addLibraries
public CelRuntimeBuilder addLibraries(CelRuntimeLibrary... libraries)
Description copied from interface:CelRuntimeBuilderAdds one or more libraries for runtime.- Specified by:
addLibrariesin interfaceCelRuntimeBuilder
-
addLibraries
public CelRuntimeBuilder addLibraries(java.lang.Iterable<? extends CelRuntimeLibrary> libraries)
Description copied from interface:CelRuntimeBuilderAdds a collection of libraries for runtime.- Specified by:
addLibrariesin interfaceCelRuntimeBuilder
-
setExtensionRegistry
public CelRuntimeBuilder 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
-
setContainer
public CelRuntimeBuilder 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
-
build
public CelRuntimeLegacyImpl build()
Build a newCelRuntimeLegacyImplinstance from the builder config.- Specified by:
buildin interfaceCelRuntimeBuilder
-
-