Class CelExpr

  • All Implemented Interfaces:
    Expression

    @Immutable
    public abstract class CelExpr
    extends java.lang.Object
    implements Expression
    An abstract representation of a common expression. Refer to Expression for details.

    This is the native type equivalent of Expr message in syntax.proto.

    • Constructor Detail

      • CelExpr

        public CelExpr()
    • Method Detail

      • id

        public abstract long id()
        Description copied from interface: Expression
        Required. An id assigned to this node by the parser which is unique in a given expression tree. This is used to associate type information and other attributes to a node in the parse tree.
        Specified by:
        id in interface Expression
      • exprKind

        public abstract CelExpr.ExprKind exprKind()
        Represents the variant of the expression.
      • constant

        public CelConstant constant()
        Gets the underlying constant expression.
        Specified by:
        constant in interface Expression
        Throws:
        java.lang.UnsupportedOperationException - if expression is not Kind#CONSTANT.
      • ident

        public CelExpr.CelIdent ident()
        Gets the underlying identifier expression.
        Specified by:
        ident in interface Expression
        Throws:
        java.lang.UnsupportedOperationException - if expression is not Kind#IDENT.
      • select

        public CelExpr.CelSelect select()
        Gets the underlying select expression.
        Specified by:
        select in interface Expression
        Throws:
        java.lang.UnsupportedOperationException - if expression is not Kind#SELECT.
      • call

        public CelExpr.CelCall call()
        Gets the underlying call expression.
        Specified by:
        call in interface Expression
        Throws:
        java.lang.UnsupportedOperationException - if expression is not Kind#CALL.
      • list

        public CelExpr.CelList list()
        Gets the underlying identifier expression.
        Specified by:
        list in interface Expression
        Throws:
        java.lang.UnsupportedOperationException - if expression is not Kind#LIST.
      • struct

        public CelExpr.CelStruct struct()
        Gets the underlying struct expression.
        Specified by:
        struct in interface Expression
        Throws:
        java.lang.UnsupportedOperationException - if expression is not Kind#STRUCT.
      • map

        public CelExpr.CelMap map()
        Gets the underlying map expression.
        Specified by:
        map in interface Expression
        Throws:
        java.lang.UnsupportedOperationException - if expression is not Kind#MAP.
      • comprehension

        public CelExpr.CelComprehension comprehension()
        Gets the underlying comprehension expression.
        Specified by:
        comprehension in interface Expression
        Throws:
        java.lang.UnsupportedOperationException - if expression is not Kind#COMPREHENSION.
      • constantOrDefault

        public CelConstant constantOrDefault()
        Gets the underlying constant expression or a default instance of one if expression is not Kind#CONSTANT.
      • identOrDefault

        public CelExpr.CelIdent identOrDefault()
        Gets the underlying identifier expression or a default instance of one if expression is not Kind#IDENT.
      • selectOrDefault

        public CelExpr.CelSelect selectOrDefault()
        Gets the underlying select expression or a default instance of one if expression is not Kind#SELECT.
      • callOrDefault

        public CelExpr.CelCall callOrDefault()
        Gets the underlying call expression or a default instance of one if expression is not Kind#CALL.
      • listOrDefault

        public CelExpr.CelList listOrDefault()
        Gets the underlying list expression or a default instance of one if expression is not Kind#LIST.
      • structOrDefault

        public CelExpr.CelStruct structOrDefault()
        Gets the underlying struct expression or a default instance of one if expression is not Kind#STRUCT.
      • mapOrDefault

        public CelExpr.CelMap mapOrDefault()
        Gets the underlying map expression or a default instance of one if expression is not Kind#MAP.
      • comprehensionOrDefault

        public CelExpr.CelComprehension comprehensionOrDefault()
        Gets the underlying comprehension expression or a default instance of one if expression is not Kind#COMPREHENSION.
      • ofNotSet

        public static CelExpr ofNotSet​(long id)
      • ofIdent

        public static CelExpr ofIdent​(long id,
                                      java.lang.String identName)
      • ofSelect

        public static CelExpr ofSelect​(long id,
                                       CelExpr operandExpr,
                                       java.lang.String field,
                                       boolean isTestOnly)
      • ofCall

        public static CelExpr ofCall​(long id,
                                     java.util.Optional<CelExpr> targetExpr,
                                     java.lang.String function,
                                     com.google.common.collect.ImmutableList<CelExpr> arguments)
      • ofList

        public static CelExpr ofList​(long id,
                                     com.google.common.collect.ImmutableList<CelExpr> elements,
                                     com.google.common.collect.ImmutableList<java.lang.Integer> optionalIndices)
      • ofStruct

        public static CelExpr ofStruct​(long id,
                                       java.lang.String messageName,
                                       com.google.common.collect.ImmutableList<CelExpr.CelStruct.Entry> entries)
      • ofStructEntry

        public static CelExpr.CelStruct.Entry ofStructEntry​(long id,
                                                            java.lang.String fieldKey,
                                                            CelExpr value,
                                                            boolean isOptionalEntry)
      • ofComprehension

        public static CelExpr ofComprehension​(long id,
                                              java.lang.String iterVar,
                                              CelExpr iterRange,
                                              java.lang.String accuVar,
                                              CelExpr accuInit,
                                              CelExpr loopCondition,
                                              CelExpr loopStep,
                                              CelExpr result)
      • ofComprehension

        public static CelExpr ofComprehension​(long id,
                                              java.lang.String iterVar,
                                              java.lang.String iterVar2,
                                              CelExpr iterRange,
                                              java.lang.String accuVar,
                                              CelExpr accuInit,
                                              CelExpr loopCondition,
                                              CelExpr loopStep,
                                              CelExpr result)
      • toString

        public final java.lang.String toString()
        Overrides:
        toString in class java.lang.Object