Interface CelVariableResolver

  • Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface CelVariableResolver
    Functional interface that exposes a method to find a CEL variable value by name.
    • Method Detail

      • find

        java.util.Optional<java.lang.Object> find​(java.lang.String name)
        Find a variable value, if present, by name.

        Variable String names may be simple, e.g. status or qualified pkg.qual.status. CEL resolves identifiers within an expression container using protobuf namespace resolution rules.

        For example, given an expression container name a.b.c.M.N and a variable name R.s, CEL evaluators will try resolve names in the following order:

        1. a.b.c.M.N.R.s
        2. a.b.c.M.R.s
        3. a.b.c.R.s
        4. a.b.R.s
        5. a.R.s
        6. R.s
      • hierarchicalVariableResolver

        static CelVariableResolver hierarchicalVariableResolver​(CelVariableResolver primary,
                                                                CelVariableResolver secondary)
        Chain two variable resolvers together, using the primary as the initial variable source to consider, and the secondary as a backup.

        When a variable appears in both resolvers, then the primary variable value will shadow the value in the secondary.