Class CelCompilerImpl

  • All Implemented Interfaces:
    CelChecker, EnvVisitable, CelCompiler, CelParser

    @Immutable
    @Internal
    public final class CelCompilerImpl
    extends java.lang.Object
    implements CelCompiler, EnvVisitable
    CelCompiler implementation which uses either the legacy or modernized CEL-Java stack to offer a stream-lined expression parse/type-check experience, via a single compile method.

    CEL Library Internals. Do Not Use. Consumers should use factories, such as CelCompilerFactory instead to instantiate a compiler.

    • Method Detail

      • parse

        public CelValidationResult parse​(java.lang.String expression,
                                         java.lang.String description)
        Description copied from interface: CelParser
        Parse the input expression and return a CelValidationResult.

        The description may be used to help tailor error messages for the location where the expression originates, e.g. a file name or form UI element.

        Parse validates the syntax of an expression.

        Specified by:
        parse in interface CelParser
      • parse

        public CelValidationResult parse​(dev.cel.common.CelSource source)
        Description copied from interface: CelParser
        Parse the input expression and return a CelValidationResult.

        The description may be used to help tailor error messages for the location where the expression originates, e.g. a file name or form UI element.

        Parse validates the syntax of an expression.

        Specified by:
        parse in interface CelParser
      • check

        public CelValidationResult check​(dev.cel.common.CelAbstractSyntaxTree ast)
        Description copied from interface: CelChecker
        Check the input ast for type-agreement and return a CelValidationResult.

        Check validates the type-agreement of the parsed CelAbstractSyntaxTree.

        Specified by:
        check in interface CelChecker
      • getTypeProvider

        public dev.cel.common.types.CelTypeProvider getTypeProvider()
        Description copied from interface: CelChecker
        Returns the underlying type provider.
        Specified by:
        getTypeProvider in interface CelChecker
      • newBuilder

        public static CelCompilerBuilder newBuilder​(CelParserBuilder parserBuilder,
                                                    CelCheckerBuilder checkerBuilder)
        Create a new builder for constructing a CelCompiler instance.

        By default, CelOptions.DEFAULT are enabled, as is the CEL standard environment.