View Javadoc

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