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 aCheckedExpr
.static CelProtoAbstractSyntaxTree
fromParsedExpr(ParsedExpr parsedExpr)
Construct an abstract syntax tree from aParsedExpr
.CelAbstractSyntaxTree
getAst()
Returns the native representation of the abstract syntax tree:CelAbstractSyntaxTree
.Expr
getExpr()
Returns the underlyingExpr
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 underlyingSourceInfo
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 underlyingCheckedExpr
representation of the abstract syntax tree.ParsedExpr
toParsedExpr()
Returns the underlyingParsedExpr
representation of the abstract syntax tree.
-
-
-
Method Detail
-
fromCheckedExpr
public static CelProtoAbstractSyntaxTree fromCheckedExpr(CheckedExpr checkedExpr)
Construct an abstract syntax tree from aCheckedExpr
.
-
fromParsedExpr
public static CelProtoAbstractSyntaxTree fromParsedExpr(ParsedExpr parsedExpr)
Construct an abstract syntax tree from aParsedExpr
.
-
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 underlyingExpr
representation of the abstract syntax tree.
-
toCheckedExpr
@CheckReturnValue public CheckedExpr toCheckedExpr()
Returns the underlyingCheckedExpr
representation of the abstract syntax tree. ThrowsIllegalStateException
ifCelAbstractSyntaxTree.isChecked()
is false.
-
getSourceInfo
@CheckReturnValue public SourceInfo getSourceInfo()
Returns the underlyingSourceInfo
representation of the abstract syntax tree.
-
toParsedExpr
@CheckReturnValue public ParsedExpr toParsedExpr()
Returns the underlyingParsedExpr
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.
-
-