Class JsrExpressionParser


  • public class JsrExpressionParser
    extends java.lang.Object

    Support class for parsing JSR-352 expressions. The JSR-352 expression syntax, for example conditional/elvis statements need to be transformed a bit to be valid SPeL expressions.

    Since:
    3.0
    Author:
    Chris Schaefer
    • Constructor Summary

      Constructors 
      ConstructorDescription
      JsrExpressionParser()
      Creates a new instance of this expression parser without and expression resolver.
      JsrExpressionParser​(org.springframework.beans.factory.config.BeanExpressionResolver beanExpressionResolver, org.springframework.beans.factory.config.BeanExpressionContext beanExpressionContext)
      Creates a new instances of this expression parser with the provided expression resolver and context to evaluate against.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      java.lang.StringparseExpression​(java.lang.String expression)
      Parses the provided expression, applying any transformations needed to evaluate as a SPeL expression.
      • Methods inherited from class java.lang.Object

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

      • JsrExpressionParser

        public JsrExpressionParser()

        Creates a new instance of this expression parser without and expression resolver. Creating an instance via this constructor will still parse expressions but no resolution of operators will occur as its expected the caller will.

      • JsrExpressionParser

        public JsrExpressionParser​(org.springframework.beans.factory.config.BeanExpressionResolver beanExpressionResolver,
                                   org.springframework.beans.factory.config.BeanExpressionContext beanExpressionContext)

        Creates a new instances of this expression parser with the provided expression resolver and context to evaluate against.

        Parameters:
        beanExpressionResolver - the expression resolver to use when resolving expressions
        beanExpressionContext - the expression context to resolve expressions against
    • Method Detail

      • parseExpression

        public java.lang.String parseExpression​(java.lang.String expression)

        Parses the provided expression, applying any transformations needed to evaluate as a SPeL expression.

        Parameters:
        expression - the expression to parse and transform
        Returns:
        a JSR-352 transformed expression that can be evaluated by a SPeL parser