Class CelExpr
- java.lang.Object
-
- dev.cel.common.ast.CelExpr
-
@Internal @Immutable public abstract class CelExpr extends java.lang.Object
An abstract representation of a common expression.This is the native type equivalent of Expr message in syntax.proto.
Expressions are abstractly represented as a collection of identifiers, select statements, function calls, literals, and comprehensions. All operators with the exception of the '.' operator are modelled as function calls. This makes it easy to represent new operators into the existing AST.
All references within expressions must resolve to a [Decl][] provided at type-check for an expression to be valid. A reference may either be a bare identifier `name` or a qualified identifier `google.api.name`. References may either refer to a value or a function declaration.
For example, the expression `google.api.name.startsWith('expr')` references the declaration `google.api.name` within a [Expr.Select][] expression, and the function declaration `startsWith`.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCelExpr.BuilderBuilder for CelExpr.static classCelExpr.CelCallA call expression, including calls to predefined functions and operators.static classCelExpr.CelComprehensionA comprehension expression applied to a list or map.static classCelExpr.CelCreateListA list creation expression.static classCelExpr.CelCreateStructA map or message creation expression.static classCelExpr.CelIdentAn identifier expression.static classCelExpr.CelNotSetAn unset expression.static classCelExpr.CelSelectA field selection expression.static classCelExpr.ExprKindDenotes the kind of the expression.
-
Constructor Summary
Constructors Constructor Description CelExpr()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description CelExpr.CelCallcall()CelExpr.CelComprehensioncomprehension()CelConstantconstant()CelExpr.CelCreateListcreateList()CelExpr.CelCreateStructcreateStruct()abstract CelExpr.ExprKindexprKind()abstract longid()CelExpr.CelIdentident()static CelExpr.BuildernewBuilder()static CelExprofCallExpr(long id, java.util.Optional<CelExpr> targetExpr, java.lang.String function, com.google.common.collect.ImmutableList<CelExpr> arguments)static CelExprofComprehension(long id, java.lang.String iterVar, CelExpr iterRange, java.lang.String accuVar, CelExpr accuInit, CelExpr loopCondition, CelExpr loopStep, CelExpr result)static CelExprofConstantExpr(long id, CelConstant celConstant)static CelExprofCreateListExpr(long id, com.google.common.collect.ImmutableList<CelExpr> elements, com.google.common.collect.ImmutableList<java.lang.Integer> optionalIndices)static CelExprofCreateStructExpr(long id, java.lang.String messageName, com.google.common.collect.ImmutableList<CelExpr.CelCreateStruct.Entry> entries)static CelExpr.CelCreateStruct.EntryofCreateStructFieldEntryExpr(long id, java.lang.String fieldKey, CelExpr value, boolean isOptionalEntry)static CelExpr.CelCreateStruct.EntryofCreateStructMapEntryExpr(long id, CelExpr mapKey, CelExpr value, boolean isOptionalEntry)static CelExprofIdentExpr(long id, java.lang.String identName)static CelExprofNotSet(long id)static CelExprofSelectExpr(long id, CelExpr operandExpr, java.lang.String field, boolean isTestOnly)CelExpr.CelSelectselect()abstract CelExpr.BuildertoBuilder()
-
-
-
Method Detail
-
id
public abstract long id()
-
exprKind
public abstract CelExpr.ExprKind exprKind()
-
constant
public CelConstant constant()
-
ident
public CelExpr.CelIdent ident()
-
select
public CelExpr.CelSelect select()
-
call
public CelExpr.CelCall call()
-
createList
public CelExpr.CelCreateList createList()
-
createStruct
public CelExpr.CelCreateStruct createStruct()
-
comprehension
public CelExpr.CelComprehension comprehension()
-
toBuilder
public abstract CelExpr.Builder toBuilder()
-
newBuilder
public static CelExpr.Builder newBuilder()
-
ofNotSet
public static CelExpr ofNotSet(long id)
-
ofConstantExpr
public static CelExpr ofConstantExpr(long id, CelConstant celConstant)
-
ofIdentExpr
public static CelExpr ofIdentExpr(long id, java.lang.String identName)
-
ofSelectExpr
public static CelExpr ofSelectExpr(long id, CelExpr operandExpr, java.lang.String field, boolean isTestOnly)
-
ofCallExpr
public static CelExpr ofCallExpr(long id, java.util.Optional<CelExpr> targetExpr, java.lang.String function, com.google.common.collect.ImmutableList<CelExpr> arguments)
-
ofCreateListExpr
public static CelExpr ofCreateListExpr(long id, com.google.common.collect.ImmutableList<CelExpr> elements, com.google.common.collect.ImmutableList<java.lang.Integer> optionalIndices)
-
ofCreateStructExpr
public static CelExpr ofCreateStructExpr(long id, java.lang.String messageName, com.google.common.collect.ImmutableList<CelExpr.CelCreateStruct.Entry> entries)
-
ofCreateStructFieldEntryExpr
public static CelExpr.CelCreateStruct.Entry ofCreateStructFieldEntryExpr(long id, java.lang.String fieldKey, CelExpr value, boolean isOptionalEntry)
-
ofCreateStructMapEntryExpr
public static CelExpr.CelCreateStruct.Entry ofCreateStructMapEntryExpr(long id, CelExpr mapKey, CelExpr value, boolean isOptionalEntry)
-
-