Package dev.cel.common.ast
Class CelExpr
- java.lang.Object
-
- dev.cel.common.ast.CelExpr
-
- All Implemented Interfaces:
Expression
@Immutable public abstract class CelExpr extends java.lang.Object implements Expression
An abstract representation of a common expression. Refer toExpressionfor details.This is the native type equivalent of Expr message in syntax.proto.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCelExpr.BuilderBuilder for CelExpr.static classCelExpr.CelCallA call expression.static classCelExpr.CelComprehensionA comprehension expression applied to a list or map.static classCelExpr.CelIdentAn identifier expression.static classCelExpr.CelListA list creation expression.static classCelExpr.CelMapA map creation expression.static classCelExpr.CelNotSetAn unset expression.static classCelExpr.CelSelectA field selection expression.static classCelExpr.CelStructA message creation expression.static classCelExpr.ExprKindDenotes the kind of the expression.-
Nested classes/interfaces inherited from interface dev.cel.common.ast.Expression
Expression.Call<E extends Expression>, Expression.Comprehension<E extends Expression>, Expression.Ident, Expression.List<E extends Expression>, Expression.Map<E extends Expression.Map.Entry<?>>, Expression.Select<E extends Expression>, Expression.Struct<E extends Expression.Struct.Entry<?>>
-
-
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()Gets the underlying call expression.CelExpr.CelCallcallOrDefault()Gets the underlying call expression or a default instance of one if expression is notCelExpr.ExprKind.Kind.CALL.CelExpr.CelComprehensioncomprehension()Gets the underlying comprehension expression.CelExpr.CelComprehensioncomprehensionOrDefault()Gets the underlying comprehension expression or a default instance of one if expression is notCelExpr.ExprKind.Kind.COMPREHENSION.CelConstantconstant()Gets the underlying constant expression.CelConstantconstantOrDefault()Gets the underlying constant expression or a default instance of one if expression is notCelExpr.ExprKind.Kind.CONSTANT.abstract CelExpr.ExprKindexprKind()Represents the variant of the expression.CelExpr.ExprKind.KindgetKind()Represents the enumeration value for the underlying expression kind.abstract longid()Required.CelExpr.CelIdentident()Gets the underlying identifier expression.CelExpr.CelIdentidentOrDefault()Gets the underlying identifier expression or a default instance of one if expression is notCelExpr.ExprKind.Kind.IDENT.CelExpr.CelListlist()Gets the underlying identifier expression.CelExpr.CelListlistOrDefault()Gets the underlying list expression or a default instance of one if expression is notCelExpr.ExprKind.Kind.LIST.CelExpr.CelMapmap()Gets the underlying map expression.CelExpr.CelMapmapOrDefault()Gets the underlying map expression or a default instance of one if expression is notCelExpr.ExprKind.Kind.MAP.static CelExpr.BuildernewBuilder()static CelExprofCall(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 CelExprofConstant(long id, CelConstant celConstant)static CelExprofIdent(long id, java.lang.String identName)static CelExprofList(long id, com.google.common.collect.ImmutableList<CelExpr> elements, com.google.common.collect.ImmutableList<java.lang.Integer> optionalIndices)static CelExprofMap(long id, com.google.common.collect.ImmutableList<CelExpr.CelMap.Entry> entries)static CelExpr.CelMap.EntryofMapEntry(long id, CelExpr mapKey, CelExpr value, boolean isOptionalEntry)static CelExprofNotSet(long id)static CelExprofSelect(long id, CelExpr operandExpr, java.lang.String field, boolean isTestOnly)static CelExprofStruct(long id, java.lang.String messageName, com.google.common.collect.ImmutableList<CelExpr.CelStruct.Entry> entries)static CelExpr.CelStruct.EntryofStructEntry(long id, java.lang.String fieldKey, CelExpr value, boolean isOptionalEntry)CelExpr.CelSelectselect()Gets the underlying select expression.CelExpr.CelSelectselectOrDefault()Gets the underlying select expression or a default instance of one if expression is notCelExpr.ExprKind.Kind.SELECT.CelExpr.CelStructstruct()Gets the underlying struct expression.CelExpr.CelStructstructOrDefault()Gets the underlying struct expression or a default instance of one if expression is notCelExpr.ExprKind.Kind.STRUCT.abstract CelExpr.BuildertoBuilder()java.lang.StringtoString()
-
-
-
Method Detail
-
id
public abstract long id()
Description copied from interface:ExpressionRequired. 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:
idin interfaceExpression
-
exprKind
public abstract CelExpr.ExprKind exprKind()
Represents the variant of the expression.
-
getKind
public CelExpr.ExprKind.Kind getKind()
Description copied from interface:ExpressionRepresents the enumeration value for the underlying expression kind.- Specified by:
getKindin interfaceExpression
-
constant
public CelConstant constant()
Gets the underlying constant expression.- Specified by:
constantin interfaceExpression- Throws:
java.lang.UnsupportedOperationException- if expression is notCelExpr.ExprKind.Kind.CONSTANT.
-
ident
public CelExpr.CelIdent ident()
Gets the underlying identifier expression.- Specified by:
identin interfaceExpression- Throws:
java.lang.UnsupportedOperationException- if expression is notCelExpr.ExprKind.Kind.IDENT.
-
select
public CelExpr.CelSelect select()
Gets the underlying select expression.- Specified by:
selectin interfaceExpression- Throws:
java.lang.UnsupportedOperationException- if expression is notCelExpr.ExprKind.Kind.SELECT.
-
call
public CelExpr.CelCall call()
Gets the underlying call expression.- Specified by:
callin interfaceExpression- Throws:
java.lang.UnsupportedOperationException- if expression is notCelExpr.ExprKind.Kind.CALL.
-
list
public CelExpr.CelList list()
Gets the underlying identifier expression.- Specified by:
listin interfaceExpression- Throws:
java.lang.UnsupportedOperationException- if expression is notCelExpr.ExprKind.Kind.LIST.
-
struct
public CelExpr.CelStruct struct()
Gets the underlying struct expression.- Specified by:
structin interfaceExpression- Throws:
java.lang.UnsupportedOperationException- if expression is notCelExpr.ExprKind.Kind.STRUCT.
-
map
public CelExpr.CelMap map()
Gets the underlying map expression.- Specified by:
mapin interfaceExpression- Throws:
java.lang.UnsupportedOperationException- if expression is notCelExpr.ExprKind.Kind.MAP.
-
comprehension
public CelExpr.CelComprehension comprehension()
Gets the underlying comprehension expression.- Specified by:
comprehensionin interfaceExpression- Throws:
java.lang.UnsupportedOperationException- if expression is notCelExpr.ExprKind.Kind.COMPREHENSION.
-
constantOrDefault
public CelConstant constantOrDefault()
Gets the underlying constant expression or a default instance of one if expression is notCelExpr.ExprKind.Kind.CONSTANT.
-
identOrDefault
public CelExpr.CelIdent identOrDefault()
Gets the underlying identifier expression or a default instance of one if expression is notCelExpr.ExprKind.Kind.IDENT.
-
selectOrDefault
public CelExpr.CelSelect selectOrDefault()
Gets the underlying select expression or a default instance of one if expression is notCelExpr.ExprKind.Kind.SELECT.
-
callOrDefault
public CelExpr.CelCall callOrDefault()
Gets the underlying call expression or a default instance of one if expression is notCelExpr.ExprKind.Kind.CALL.
-
listOrDefault
public CelExpr.CelList listOrDefault()
Gets the underlying list expression or a default instance of one if expression is notCelExpr.ExprKind.Kind.LIST.
-
structOrDefault
public CelExpr.CelStruct structOrDefault()
Gets the underlying struct expression or a default instance of one if expression is notCelExpr.ExprKind.Kind.STRUCT.
-
mapOrDefault
public CelExpr.CelMap mapOrDefault()
Gets the underlying map expression or a default instance of one if expression is notCelExpr.ExprKind.Kind.MAP.
-
comprehensionOrDefault
public CelExpr.CelComprehension comprehensionOrDefault()
Gets the underlying comprehension expression or a default instance of one if expression is notCelExpr.ExprKind.Kind.COMPREHENSION.
-
toBuilder
public abstract CelExpr.Builder toBuilder()
-
newBuilder
public static CelExpr.Builder newBuilder()
-
ofNotSet
public static CelExpr ofNotSet(long id)
-
ofConstant
public static CelExpr ofConstant(long id, CelConstant celConstant)
-
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)
-
ofMap
public static CelExpr ofMap(long id, com.google.common.collect.ImmutableList<CelExpr.CelMap.Entry> entries)
-
ofStructEntry
public static CelExpr.CelStruct.Entry ofStructEntry(long id, java.lang.String fieldKey, CelExpr value, boolean isOptionalEntry)
-
ofMapEntry
public static CelExpr.CelMap.Entry ofMapEntry(long id, CelExpr mapKey, 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)
-
toString
public final java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-