Class ExpressionProcessor
- java.lang.Object
-
- io.zeebe.engine.processing.common.ExpressionProcessor
-
public final class ExpressionProcessor extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classExpressionProcessor.CorrelationKeyResultHandlerstatic classExpressionProcessor.EvaluationExceptionstatic interfaceExpressionProcessor.VariablesLookup
-
Constructor Summary
Constructors Constructor Description ExpressionProcessor(io.zeebe.el.ExpressionLanguage expressionLanguage, ExpressionProcessor.VariablesLookup lookup)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Either<Failure,org.agrona.DirectBuffer>evaluateAnyExpression(io.zeebe.el.Expression expression, long scopeKey)Evaluates the given expression and returns the result no matter the type.Either<Failure,List<org.agrona.DirectBuffer>>evaluateArrayExpression(io.zeebe.el.Expression expression, long scopeKey)Evaluates the given expression and returns the result as a list.Either<Failure,Boolean>evaluateBooleanExpression(io.zeebe.el.Expression expression, long scopeKey)Evaluates the given expression and returns the result as boolean.Either<Failure,ZonedDateTime>evaluateDateTimeExpression(io.zeebe.el.Expression expression, Long scopeKey)Evaluates the given expression and returns the result as ZonedDateTime.Either<Failure,Interval>evaluateIntervalExpression(io.zeebe.el.Expression expression, long scopeKey)Evaluates the given expression and returns the result as an Interval.Either<Failure,Long>evaluateLongExpression(io.zeebe.el.Expression expression, long scopeKey)Evaluates the given expression and returns the result as long.StringevaluateMessageCorrelationKeyExpression(io.zeebe.el.Expression expression, long scopeKey)Evaluates the given expression and returns the result as String.Either<Failure,String>evaluateStringExpression(io.zeebe.el.Expression expression, long scopeKey)Evaluates the given expression and returns the result as string.Either<Failure,org.agrona.DirectBuffer>evaluateStringExpressionAsDirectBuffer(io.zeebe.el.Expression expression, long scopeKey)Evaluates the given expression and returns the result as string wrapped inDirectBuffer.Either<Failure,org.agrona.DirectBuffer>evaluateVariableMappingExpression(io.zeebe.el.Expression expression, long scopeKey)Evaluates the given expression of a variable mapping and returns the result as buffer.
-
-
-
Constructor Detail
-
ExpressionProcessor
public ExpressionProcessor(io.zeebe.el.ExpressionLanguage expressionLanguage, ExpressionProcessor.VariablesLookup lookup)
-
-
Method Detail
-
evaluateStringExpression
public Either<Failure,String> evaluateStringExpression(io.zeebe.el.Expression expression, long scopeKey)
Evaluates the given expression and returns the result as string. If the evaluation fails or the result is not a string then a failure is returned.- Parameters:
expression- the expression to evaluatescopeKey- the scope to load the variables from (a negative key is intended to imply an empty variable context)- Returns:
- either the evaluation result as string, or a failure
-
evaluateStringExpressionAsDirectBuffer
public Either<Failure,org.agrona.DirectBuffer> evaluateStringExpressionAsDirectBuffer(io.zeebe.el.Expression expression, long scopeKey)
Evaluates the given expression and returns the result as string wrapped inDirectBuffer. If the evaluation fails or the result is not a string then a failure is returned.- Parameters:
expression- the expression to evaluatescopeKey- the scope to load the variables from (a negative key is intended to imply an empty variable context)- Returns:
- either the evaluation result as buffer, or a failure
-
evaluateLongExpression
public Either<Failure,Long> evaluateLongExpression(io.zeebe.el.Expression expression, long scopeKey)
Evaluates the given expression and returns the result as long. If the evaluation fails or the result is not a number then a failure is returned.- Parameters:
expression- the expression to evaluatescopeKey- the scope to load the variables from (a negative key is intended to imply an empty variable context)- Returns:
- either the evaluation result as long, or a failure
-
evaluateBooleanExpression
public Either<Failure,Boolean> evaluateBooleanExpression(io.zeebe.el.Expression expression, long scopeKey)
Evaluates the given expression and returns the result as boolean. If the evaluation fails or the result is not a boolean then a failure is returned.- Parameters:
expression- the expression to evaluatescopeKey- the scope to load the variables from (a negative key is intended to imply an empty variable context)- Returns:
- either the evaluation result as boolean, or a failure
-
evaluateIntervalExpression
public Either<Failure,Interval> evaluateIntervalExpression(io.zeebe.el.Expression expression, long scopeKey)
Evaluates the given expression and returns the result as an Interval. If the evaluation fails or the result is not an interval then a failure is returned.- Parameters:
expression- the expression to evaluatescopeKey- the scope to load the variables from (a negative key is intended to imply an empty variable context)- Returns:
- either the evaluation result as interval or a failure
-
evaluateDateTimeExpression
public Either<Failure,ZonedDateTime> evaluateDateTimeExpression(io.zeebe.el.Expression expression, Long scopeKey)
Evaluates the given expression and returns the result as ZonedDateTime. If the evaluation fails or the result is not a ZonedDateTime then a failure is returned.- Parameters:
expression- the expression to evaluatescopeKey- the scope to load the variables from (a negative key is intended to imply an empty variable context)- Returns:
- either the evaluation result as ZonedDateTime or a failure
- Throws:
ExpressionProcessor.EvaluationException- if expression evaluation failed
-
evaluateAnyExpression
public Either<Failure,org.agrona.DirectBuffer> evaluateAnyExpression(io.zeebe.el.Expression expression, long scopeKey)
Evaluates the given expression and returns the result no matter the type.- Parameters:
expression- the expression to evaluatescopeKey- the scope to load the variables from (a negative key is intended to imply an empty variable context)- Returns:
- either the evaluation result as buffer, or a failure if the evaluation fails
-
evaluateArrayExpression
public Either<Failure,List<org.agrona.DirectBuffer>> evaluateArrayExpression(io.zeebe.el.Expression expression, long scopeKey)
Evaluates the given expression and returns the result as a list. The entries of the list are encoded in MessagePack and can have any type.- Parameters:
expression- the expression to evaluatescopeKey- the scope to load the variables from (a negative key is intended to imply an empty variable context)- Returns:
- either the evaluation result as a list, or a failure if the evaluation fails
-
evaluateMessageCorrelationKeyExpression
public String evaluateMessageCorrelationKeyExpression(io.zeebe.el.Expression expression, long scopeKey)
Evaluates the given expression and returns the result as String. If the evaluation fails or the result is not a string or number (the latter of which is automatically converted to a string), then an exception is thrown.- Parameters:
expression- the expression to evaluatescopeKey- the scope to load the variables from (a negative key is intended to imply an empty variable context)- Returns:
- the evaluation result as String
- Throws:
MessageCorrelationKeyException- if the evaluation fails or the result is not a string or number
-
evaluateVariableMappingExpression
public Either<Failure,org.agrona.DirectBuffer> evaluateVariableMappingExpression(io.zeebe.el.Expression expression, long scopeKey)
Evaluates the given expression of a variable mapping and returns the result as buffer. If the evaluation fails or the result is not a context then a failure is returned.- Parameters:
expression- the expression to evaluatescopeKey- the scope to load the variables from (a negative key is intended to imply an empty variable context)- Returns:
- either the evaluation result as buffer, or a failure
-
-