Package dev.cel.runtime
Class InterpreterUtil
- java.lang.Object
-
- dev.cel.runtime.InterpreterUtil
-
@Internal public final class InterpreterUtil extends java.lang.Object
Util class for CEL interpreter.CEL Library Internals. Do Not Use.
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static ExprValuecombineUnknownExprValue(java.lang.Object... objs)Combine multiple ExprValue objects which has UnknownSet into one ExprValuestatic java.lang.ObjectcompleteDataOnly(java.lang.Object obj, java.lang.String exceptionMessage)Deprecated.static ExprValuecreateUnknownExprValue(java.lang.Long... ids)Create aExprValuefor one or moreidsrepresenting an unknown set.static ExprValuecreateUnknownExprValue(java.util.List<java.lang.Long> ids)Create an ExprValue object has UnknownSet, from a list of unknown expr idsstatic booleanisUnknown(java.lang.Object obj)Check if raw object is ExprValue object and has UnknownSetstatic java.lang.ObjectshortcircuitUnknownOrThrowable(java.lang.Object left, java.lang.Object right)Short circuit unknown or error arguments to logical operators.static java.lang.Objectstrict(java.lang.Object valueOrThrowable)Enforces strictness.static java.lang.ObjectvalueOrUnknown(@Nullable java.lang.Object valueOrThrowable, java.lang.Long id)
-
-
-
Method Detail
-
strict
public static java.lang.Object strict(java.lang.Object valueOrThrowable) throws InterpreterExceptionEnforces strictness. The outcome of a failed computation is represented by the value being aThrowable. Applyingstrict()to such a value-or-throwable will re-throw the proper exception.- Throws:
InterpreterException
-
isUnknown
public static boolean isUnknown(java.lang.Object obj)
Check if raw object is ExprValue object and has UnknownSet- Parameters:
obj- Object to check.- Returns:
- boolean value if object is unknown.
-
completeDataOnly
@CanIgnoreReturnValue @Deprecated public static java.lang.Object completeDataOnly(java.lang.Object obj, java.lang.String exceptionMessage) throws InterpreterExceptionDeprecated.Throws an InterpreterException withexceptionMessageif theobjis an instance ofIncompleteData.IncompleteDatadoes not support some operators.Returns the obj argument otherwise.
Deprecated. TODO: Can be removed once clients have stopped using IncompleteData.
- Throws:
InterpreterException
-
combineUnknownExprValue
public static ExprValue combineUnknownExprValue(java.lang.Object... objs)
Combine multiple ExprValue objects which has UnknownSet into one ExprValue- Parameters:
objs- ExprValue objects which has UnknownSet- Returns:
- A new ExprValue object which has all unknown expr ids from input objects, without duplication.
-
createUnknownExprValue
public static ExprValue createUnknownExprValue(java.lang.Long... ids)
Create aExprValuefor one or moreidsrepresenting an unknown set.
-
createUnknownExprValue
public static ExprValue createUnknownExprValue(java.util.List<java.lang.Long> ids)
Create an ExprValue object has UnknownSet, from a list of unknown expr ids- Parameters:
ids- List of unknown expr ids- Returns:
- A new ExprValue object which has all unknown expr ids from input list
-
shortcircuitUnknownOrThrowable
public static java.lang.Object shortcircuitUnknownOrThrowable(java.lang.Object left, java.lang.Object right) throws InterpreterExceptionShort circuit unknown or error arguments to logical operators.Given two arguments, one of which must be throwable (error) or unknown, returns the result from the && or || operators for these arguments, assuming that the result cannot be determined from any boolean arguments alone. This allows us to consolidate the error/unknown handling for both of these operators.
- Throws:
InterpreterException
-
valueOrUnknown
public static java.lang.Object valueOrUnknown(@Nullable java.lang.Object valueOrThrowable, java.lang.Long id)
-
-