Interface Expression
-
- All Known Implementing Classes:
CelExpr
@Internal public interface Expression
An abstract representation of a common expression.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 Interface Description static interface
Expression.Call<E extends Expression>
A call expression, including calls to predefined functions and operators.static interface
Expression.Comprehension<E extends Expression>
A comprehension expression applied to a list or map.static interface
Expression.Ident
An identifier expression.static interface
Expression.List<E extends Expression>
A list creation expression.static interface
Expression.Map<E extends Expression.Map.Entry<?>>
A map creation expression.static interface
Expression.Select<E extends Expression>
A field selection expression.static interface
Expression.Struct<E extends Expression.Struct.Entry<?>>
A message creation expression.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <E extends Expression>
Expression.Call<E>call()
Gets the underlying call expression.<E extends Expression>
Expression.Comprehension<E>comprehension()
Gets the underlying comprehension expression.CelConstant
constant()
Gets the underlying constant expression.CelExpr.ExprKind.Kind
getKind()
Represents the enumeration value for the underlying expression kind.long
id()
Required.Expression.Ident
ident()
Gets the underlying identifier expression.<E extends Expression>
Expression.List<E>list()
Gets the underlying identifier expression.<E extends Expression>
Expression.Map<Expression.Map.Entry<E>>map()
Gets the underlying map expression.<E extends Expression>
Expression.Select<E>select()
Gets the underlying select expression.<E extends Expression>
Expression.Struct<Expression.Struct.Entry<E>>struct()
Gets the underlying struct expression.
-
-
-
Method Detail
-
id
long id()
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.
-
getKind
CelExpr.ExprKind.Kind getKind()
Represents the enumeration value for the underlying expression kind.
-
constant
CelConstant constant()
Gets the underlying constant expression.
-
ident
Expression.Ident ident()
Gets the underlying identifier expression.
-
call
<E extends Expression> Expression.Call<E> call()
Gets the underlying call expression.
-
list
<E extends Expression> Expression.List<E> list()
Gets the underlying identifier expression.
-
select
<E extends Expression> Expression.Select<E> select()
Gets the underlying select expression.
-
struct
<E extends Expression> Expression.Struct<Expression.Struct.Entry<E>> struct()
Gets the underlying struct expression.
-
map
<E extends Expression> Expression.Map<Expression.Map.Entry<E>> map()
Gets the underlying map expression.
-
comprehension
<E extends Expression> Expression.Comprehension<E> comprehension()
Gets the underlying comprehension expression.
-
-