Package dev.cel.common.ast
Class CelExprUtil
- java.lang.Object
-
- dev.cel.common.ast.CelExprUtil
-
public final class CelExprUtil extends java.lang.ObjectUtility class for working with CelExpr.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.ObjectevaluateExpr(Cel cel, CelExpr expr)Type-checks and evaluates a CelExpr.static java.lang.ObjectevaluateExpr(Cel cel, CelExpr expr, java.lang.Class<?> expectedResultType)Type-checks and evaluates a CelExpr.
-
-
-
Method Detail
-
evaluateExpr
@CanIgnoreReturnValue public static java.lang.Object evaluateExpr(Cel cel, CelExpr expr) throws CelValidationException, CelEvaluationException
Type-checks and evaluates a CelExpr. This method should be used in the context of validating or optimizing an AST.- Returns:
- Evaluated result.
- Throws:
CelValidationException- if CelExpr fails to type-check.CelEvaluationException- if CelExpr fails to evaluate.
-
evaluateExpr
@CanIgnoreReturnValue public static java.lang.Object evaluateExpr(Cel cel, CelExpr expr, java.lang.Class<?> expectedResultType) throws CelValidationException, CelEvaluationException
Type-checks and evaluates a CelExpr. The evaluated result is then checked to see if it's the expected result type.This method should be used in the context of validating or optimizing an AST.
- Returns:
- Evaluated result.
- Throws:
CelValidationException- if CelExpr fails to type-check.CelEvaluationException- if CelExpr fails to evaluate.java.lang.IllegalStateException- if the evaluated result is not of typeexpectedResultType.
-
-