Interface ParserContext

All Known Implementing Classes:
TemplateParserContext

public interface ParserContext
Input provided to an expression parser that can influence an expression parsing/compilation routine.
Since:
3.0
Author:
Keith Donald, Andy Clement
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final ParserContext
    The default ParserContext implementation that enables template expression parsing mode.
  • Method Summary

    Modifier and Type
    Method
    Description
    For template expressions, returns the prefix that identifies the start of an expression block within a string.
    For template expressions, return the prefix that identifies the end of an expression block within a string.
    boolean
    Whether the expression being parsed is a template.
  • Field Details

    • TEMPLATE_EXPRESSION

      static final ParserContext TEMPLATE_EXPRESSION
      The default ParserContext implementation that enables template expression parsing mode. The expression prefix is "#{" and the expression suffix is "}".
      See Also:
  • Method Details

    • isTemplate

      boolean isTemplate()
      Whether the expression being parsed is a template.

      A template consists of literal text that can be mixed with expressions. Some examples:

           Some literal text
           Hello #{name.firstName}!
           #{3 + 4}
       
      Returns:
      true if the expression is a template, false otherwise
    • getExpressionPrefix

      String getExpressionPrefix()
      For template expressions, returns the prefix that identifies the start of an expression block within a string. For example: "${"
      Returns:
      the prefix that identifies the start of an expression
    • getExpressionSuffix

      String getExpressionSuffix()
      For template expressions, return the prefix that identifies the end of an expression block within a string. For example: "}"
      Returns:
      the suffix that identifies the end of an expression