Class FeelEngineWrapper

java.lang.Object
io.camunda.connector.runtime.util.feel.FeelEngineWrapper

public class FeelEngineWrapper extends Object
Wrapper for the FEEL engine, handling type conversions and expression evaluations.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor, creating an ObjectMapper and a FeelEngine with default configuration.
    FeelEngineWrapper(org.camunda.feel.FeelEngine feelEngine, com.fasterxml.jackson.databind.ObjectMapper objectMapper)
    Injection constructor allowing to pass in the FeelEngine and ObjectMapper to use.
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    evaluate(String expression, Object variables)
    Evaluates an expression with the FEEL engine with the given variables.
    evaluateToJson(String expression, Object variables)
    Evaluates an expression to a JSON String.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • FeelEngineWrapper

      public FeelEngineWrapper()
      Default constructor, creating an ObjectMapper and a FeelEngine with default configuration.
    • FeelEngineWrapper

      public FeelEngineWrapper(org.camunda.feel.FeelEngine feelEngine, com.fasterxml.jackson.databind.ObjectMapper objectMapper)
      Injection constructor allowing to pass in the FeelEngine and ObjectMapper to use.
      Parameters:
      feelEngine - the FEEL engine to use
      objectMapper - the object mapper to use
  • Method Details

    • evaluate

      public <T> T evaluate(String expression, Object variables)
      Evaluates an expression with the FEEL engine with the given variables.
      Type Parameters:
      T - the type to cast the evaluation result to
      Parameters:
      expression - the expression to evaluate
      variables - the variables to use in evaluation
      Returns:
      the evaluation result
      Throws:
      FeelEngineWrapperException - when there is an exception message as a result of the evaluation or the result cannot be cast to the given type
    • evaluateToJson

      public String evaluateToJson(String expression, Object variables)
      Evaluates an expression to a JSON String.
      Parameters:
      expression - the expression to evaluate
      variables - the variables to use in evaluation
      Returns:
      the JSON String representing the evaluation result
      Throws:
      FeelEngineWrapperException - when there is an exception message as a result of the evaluation or the result cannot be parsed as JSON