Class ExpressionExtractor

Object
ExpressionExtractor

public class ExpressionExtractor extends Object
Helper class that allows the extraction of CQL expressions out of a plain text string using special separators. Parsing rules are:
  • whatever is between ${ and } is considered a CQL expression
  • $ and } can be used stand alone only escaped with \ (e.g. \$ and \})
  • \ can be used stand alone only escaped with another \ (e.g. \\)
Examples of valid expressions:
  • "one two three \} \$ \\" (simple literal with special chars escaped)
  • "My name is ${name}" (a simple attribute reference)
  • "Hi this is ${(intAtt + 2) * 10}" (cql using attribute and math expressions)
Examples of non valid expressions:
  • "bla ${myAttName" (unclosed expression section)
  • "bla } bla" (} is reserved, should have been escaped)
Author:
Andrea Aime - TOPP
  • Constructor Details

    • ExpressionExtractor

      public ExpressionExtractor()
  • Method Details

    • extractCqlExpressions

      public static Expression extractCqlExpressions(String expression)
      Builds a CQL expression equivalent to the specified string, see class javadocs for rules on how to build the expression in string form
    • cleanExpressionCache

      public static void cleanExpressionCache()
      Clears the CQL expression cache