View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.expression;
8   
9   import org.mule.api.MuleContext;
10  import org.mule.api.MuleMessage;
11  import org.mule.api.context.MuleContextAware;
12  import org.mule.api.expression.ExpressionEvaluator;
13  
14  /**
15   * Will process an expression string that can contain other expressions
16   */
17  public class StringExpressionEvaluator implements ExpressionEvaluator, MuleContextAware
18  {
19      public static final String NAME = "string";
20  
21      private MuleContext context;
22  
23      public void setMuleContext(MuleContext context)
24      {
25          this.context = context;
26      }
27  
28      public Object evaluate(String expression, MuleMessage message)
29      {
30          return context.getExpressionManager().parse(expression, message);
31      }
32  
33      /**
34       * Gts the name of the object
35       *
36       * @return the name of the object
37       */
38      public String getName()
39      {
40          return NAME;
41      }
42  
43      /**
44       * Sets the name of the object
45       *
46       * @param name the name of the object
47       */
48      public void setName(String name)
49      {
50          throw new UnsupportedOperationException();
51      }
52  }