Class Expressions

java.lang.Object
com.api.jsonata4java.expressions.Expressions
All Implemented Interfaces:
Serializable

public class Expressions extends Object implements Serializable
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Expressions(org.antlr.v4.runtime.tree.ParseTree aTree, String anExpression)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    com.fasterxml.jackson.databind.JsonNode
    evaluate(com.fasterxml.jackson.databind.JsonNode rootContext)
    Evaluate the stored expression against the supplied event and application interface data.
    com.fasterxml.jackson.databind.JsonNode
    evaluate(com.fasterxml.jackson.databind.JsonNode rootContext, long timeoutMS, int maxDepth)
    Evaluate the stored expression against the supplied event and application interface data.
    com.fasterxml.jackson.databind.JsonNode
    evaluateSynced(com.fasterxml.jackson.databind.JsonNode rootContext)
    Evaluate the stored expression with synchronization to enable multi-threaded execution against the supplied event and application interface data.
    com.fasterxml.jackson.databind.JsonNode
    evaluateSynced(com.fasterxml.jackson.databind.JsonNode rootContext, long timeoutMS, int maxDepth)
    Evaluate the stored expression with synchronization to enable multi-threaded execution against the supplied event and application interface data.
     
     
    static List<String>
    getRefsInExpression(Pattern refPattern, String expression)
    Returns a list of $something references in the given expression, using the given Pattern object (typically patterns should match on $state or $event)
    org.antlr.v4.runtime.tree.ParseTree
     
    parse(String mappingExpression)
     
    void
     
    void
    setTree(org.antlr.v4.runtime.tree.ParseTree parsetree)
     
    void
    timeboxExpression(long timeoutMS, int maxDepth)
     
     

    Methods inherited from class java.lang.Object

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

    • Expressions

      public Expressions(org.antlr.v4.runtime.tree.ParseTree aTree, String anExpression)
  • Method Details

    • getRefsInExpression

      public static List<String> getRefsInExpression(Pattern refPattern, String expression)
      Returns a list of $something references in the given expression, using the given Pattern object (typically patterns should match on $state or $event)
      Parameters:
      refPattern - reference pattern
      expression - expression to be searched for references
      Returns:
      list of references
    • parse

      public static Expressions parse(String mappingExpression) throws ParseException, IOException
      Throws:
      ParseException
      IOException
    • evaluate

      public com.fasterxml.jackson.databind.JsonNode evaluate(com.fasterxml.jackson.databind.JsonNode rootContext) throws EvaluateException
      Evaluate the stored expression against the supplied event and application interface data.
      Parameters:
      rootContext - bound to root context ($$ and paths that don't start with $event, $state or $instance) when evaluating expressions. May be null.
      Returns:
      the JsonNode resulting from the expression evaluation against the rootContext. A null will be returned if no match is found (note a JSON null will result in a JsonNode of type NullNode).
      Throws:
      EvaluateException - If the given device event is invalid.
    • evaluate

      public com.fasterxml.jackson.databind.JsonNode evaluate(com.fasterxml.jackson.databind.JsonNode rootContext, long timeoutMS, int maxDepth) throws EvaluateException
      Evaluate the stored expression against the supplied event and application interface data.
      Parameters:
      rootContext - bound to root context ($$ and paths that don't start with $event, $state or $instance) when evaluating expressions. May be null.
      timeoutMS - milliseconds allowed for the evaluation to occur. If it takes longer an exception is thrown. Must be positive number or exception is thrown.
      maxDepth - the maximum call stack depth allowed before an exception is thrown. Must be a positive number or an exception is thrown.
      Returns:
      the JsonNode resulting from the expression evaluation against the rootContext. A null will be returned if no match is found (note a JSON null will result in a JsonNode of type NullNode).
      Throws:
      EvaluateException - If the given device event is invalid.
    • evaluateSynced

      public com.fasterxml.jackson.databind.JsonNode evaluateSynced(com.fasterxml.jackson.databind.JsonNode rootContext) throws EvaluateException
      Evaluate the stored expression with synchronization to enable multi-threaded execution against the supplied event and application interface data.
      Parameters:
      rootContext - bound to root context ($$ and paths that don't start with $event, $state or $instance) when evaluating expressions. May be null.
      Returns:
      the JsonNode resulting from the expression evaluation against the rootContext. A null will be returned if no match is found (note a JSON null will result in a JsonNode of type NullNode).
      Throws:
      EvaluateException - If the given device event is invalid.
    • evaluateSynced

      public com.fasterxml.jackson.databind.JsonNode evaluateSynced(com.fasterxml.jackson.databind.JsonNode rootContext, long timeoutMS, int maxDepth) throws EvaluateException
      Evaluate the stored expression with synchronization to enable multi-threaded execution against the supplied event and application interface data.
      Parameters:
      rootContext - bound to root context ($$ and paths that don't start with $event, $state or $instance) when evaluating expressions. May be null.
      timeoutMS - milliseconds allowed for the evaluation to occur. If it takes longer an exception is thrown. Must be positive number or exception is thrown.
      maxDepth - the maximum call stack depth allowed before an exception is thrown. Must be a positive number or an exception is thrown.
      Returns:
      the JsonNode resulting from the expression evaluation against the rootContext. A null will be returned if no match is found (note a JSON null will result in a JsonNode of type NullNode).
      Throws:
      EvaluateException - If the given device event is invalid.
    • getEnvironment

      public FrameEnvironment getEnvironment()
    • getExpr

      public ExpressionsVisitor getExpr()
    • getTree

      public org.antlr.v4.runtime.tree.ParseTree getTree()
    • setExpr

      public void setExpr(ExpressionsVisitor expr)
    • setTree

      public void setTree(org.antlr.v4.runtime.tree.ParseTree parsetree)
    • timeboxExpression

      public void timeboxExpression(long timeoutMS, int maxDepth)
    • toString

      public String toString()
      Overrides:
      toString in class Object