Interface CelRuntimeBuilder

    • Method Detail

      • setOptions

        @CanIgnoreReturnValue
        CelRuntimeBuilder setOptions​(dev.cel.common.CelOptions options)
        Set the CelOptions used to enable fixes and features for this CEL instance.
      • addFunctionBindings

        @CanIgnoreReturnValue
        CelRuntimeBuilder addFunctionBindings​(CelFunctionBinding... bindings)
        Add one or more CelFunctionBinding objects 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 of CelFunctionBinding objects 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 message Descriptors.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:

      • addMessageTypes

        @CanIgnoreReturnValue
        CelRuntimeBuilder addMessageTypes​(java.lang.Iterable<com.google.protobuf.Descriptors.Descriptor> descriptors)
        Add message Descriptors.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:

      • setTypeProvider

        @CanIgnoreReturnValue
        CelRuntimeBuilder setTypeProvider​(dev.cel.common.types.CelTypeProvider celTypeProvider)
        Sets the CelTypeProvider for 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:

      • setValueProvider

        @CanIgnoreReturnValue
        CelRuntimeBuilder setValueProvider​(CelValueProvider celValueProvider)
        Sets the CelValueProvider for resolving struct values during evaluation. Multiple providers can be combined using CombinedCelValueProvider. 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​(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 the CelContainer to use as the namespace for resolving CEL expression variables and functions.
      • build

        @CheckReturnValue
        CelRuntime build()
        Build a new instance of the CelRuntime.