Package dev.cel.common
Class CelProtoAbstractSyntaxTree
- java.lang.Object
-
- dev.cel.common.CelProtoAbstractSyntaxTree
-
public final class CelProtoAbstractSyntaxTree extends java.lang.Object
An Adapter forCelAbstractSyntaxTree
constructed from Canonical Protos ofCheckedExpr
orParsedExpr
expressions.Note: Keep this file in sync with
CelProtoV1Alpha1AbstractSyntaxTree
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CelProtoAbstractSyntaxTree
fromCelAst(CelAbstractSyntaxTree ast)
Constructs CelProtoAbstractSyntaxTree fromCelAbstractSyntaxTree
.static CelProtoAbstractSyntaxTree
fromCheckedExpr(CheckedExpr checkedExpr)
Construct an abstract syntax tree from acom.google.api.expr.CheckedExpr
.static CelProtoAbstractSyntaxTree
fromParsedExpr(ParsedExpr parsedExpr)
Construct an abstract syntax tree from acom.google.api.expr.ParsedExpr
.CelAbstractSyntaxTree
getAst()
Returns the native representation of the abstract syntax tree:CelAbstractSyntaxTree
.Expr
getExpr()
Returns the underlyingcom.google.api.expr.Expr
representation of the abstract syntax tree.Type
getProtoResultType()
For a type checked abstract syntax tree the resulting type is returned in proto format described in checked.proto.SourceInfo
getSourceInfo()
Returns the underlyingcom.google.api.expr.SourceInfo
representation of the abstract syntax tree.boolean
isChecked()
Tests whether the underlying abstract syntax tree has been type checked or not.CheckedExpr
toCheckedExpr()
Returns the underlyingcom.google.api.expr.CheckedExpr
representation of the abstract syntax tree.ParsedExpr
toParsedExpr()
Returns the underlyingcom.google.api.expr.ParsedExpr
representation of the abstract syntax tree.
-
-
-
Method Detail
-
fromCheckedExpr
public static CelProtoAbstractSyntaxTree fromCheckedExpr(CheckedExpr checkedExpr)
Construct an abstract syntax tree from acom.google.api.expr.CheckedExpr
.
-
fromParsedExpr
public static CelProtoAbstractSyntaxTree fromParsedExpr(ParsedExpr parsedExpr)
Construct an abstract syntax tree from acom.google.api.expr.ParsedExpr
.
-
fromCelAst
public static CelProtoAbstractSyntaxTree fromCelAst(CelAbstractSyntaxTree ast)
Constructs CelProtoAbstractSyntaxTree fromCelAbstractSyntaxTree
.
-
isChecked
public boolean isChecked()
Tests whether the underlying abstract syntax tree has been type checked or not.
-
getAst
@CheckReturnValue public CelAbstractSyntaxTree getAst()
Returns the native representation of the abstract syntax tree:CelAbstractSyntaxTree
.
-
getExpr
@CheckReturnValue public Expr getExpr()
Returns the underlyingcom.google.api.expr.Expr
representation of the abstract syntax tree.
-
toCheckedExpr
@CheckReturnValue public CheckedExpr toCheckedExpr()
Returns the underlyingcom.google.api.expr.CheckedExpr
representation of the abstract syntax tree. ThrowsIllegalStateException
ifCelAbstractSyntaxTree.isChecked()
is false.
-
getSourceInfo
@CheckReturnValue public SourceInfo getSourceInfo()
Returns the underlyingcom.google.api.expr.SourceInfo
representation of the abstract syntax tree.
-
toParsedExpr
@CheckReturnValue public ParsedExpr toParsedExpr()
Returns the underlyingcom.google.api.expr.ParsedExpr
representation of the abstract syntax tree.
-
getProtoResultType
@CheckReturnValue public Type getProtoResultType()
For a type checked abstract syntax tree the resulting type is returned in proto format described in checked.proto. Otherwise, the dynamic type is returned.
-
-