Class CompositeExpression

  • All Implemented Interfaces:
    Expression

    public class CompositeExpression
    extends ExpressionSupport

    CompositeExpression is a Composite expression made up of several Expression objects which are concatenated into a single String.

    Version:
    $Revision: 155420 $
    Author:
    James Strachan
    • Constructor Detail

      • CompositeExpression

        public CompositeExpression()
      • CompositeExpression

        public CompositeExpression​(List expressions)
    • Method Detail

      • parse

        public static Expression parse​(String text,
                                       ExpressionFactory factory)
                                throws JellyException
        Parses the given String to be either a ConstantExpression, an Expression denoted as "${foo}" or some String with embedded expressions such as "abc${something}def${else}xyz" which results in a CompositeExpression being returned.
        Parameters:
        text - is the String to parse into expressions
        factory - is the Factory of Expression objects used to create expressions for the contents of the String "foo" inside expressions such as "${foo}"
        Returns:
        the Expression for the given String.
        Throws:
        JellyException - if the text is invalid (such as missing '}' character).
        JellyException - if there was some problem creating the underlying Expression object from the ExpressionFactory
      • getExpressions

        public List getExpressions()
        Returns:
        the Expression objects that make up this composite expression
      • setExpressions

        public void setExpressions​(List expressions)
        Sets the Expression objects that make up this composite expression
      • addExpression

        public void addExpression​(Expression expression)
        Adds a new expression to the end of the expression list
      • addTextExpression

        public void addTextExpression​(String text)
        A helper method to add a new constant text expression
      • getExpressionText

        public String getExpressionText()
        Returns:
        the textual representation of this expression
      • evaluate

        public Object evaluate​(JellyContext context)
        Description copied from interface: Expression
        Evaluates the expression with the given context and returns the result