com.tibbo.aggregate.common.expression

## Class ParsedExpressionCache

- java.lang.Object
- - com.tibbo.aggregate.common.expression.ParsedExpressionCache

-     public class ParsedExpressionCache
      extends java.lang.Object

  A wrapper around Guava's `LoadingCache` that stores parsed versions of AggreGate expressions, i.e. instances of abstract syntax trees. The caching is based on the fact that for every expression text there is only one parsed abstract syntax tree, so the text can be used as a key of the cache and the root of the tree can be a value.
  Since:
    AGG-16346
  See Also:
    Guava Caches Explained

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ParsedExpressionCache()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static ASTStart` | `getCachedAstRoot(java.lang.String expressionText)` Tries to find corresponding parsed tree in the underlying cache and, if not found, transparently parses the expression, enters the tree into the cache and returns the tree as it was stored in the cache before.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ParsedExpressionCache

          public ParsedExpressionCache()

  - ### Method Detail

    - #### getCachedAstRoot

          public static ASTStart getCachedAstRoot(java.lang.String expressionText)
                                           throws SyntaxErrorException

      Tries to find corresponding parsed tree in the underlying cache and, if not found, transparently parses the expression, enters the tree into the cache and returns the tree as it was stored in the cache before.
      Parameters:
        `expressionText` - the text of the expression to find corresponding AST for
      Returns:
        the root of the parsed tree, either cached previously or freshly built
      Throws:
        `SyntaxErrorException` - if the expression cannot be parsed due to a syntax error