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.MuleMessage;
10  import org.mule.api.expression.ExpressionEvaluator;
11  import org.mule.api.transport.PropertyScope;
12  
13  /**
14   * Looks up the variable on the message using the name given.
15   * 
16   * @see ExpressionEvaluator
17   * @see DefaultExpressionManager
18   */
19  public class VariableExpressionEvaluator implements ExpressionEvaluator
20  {
21      public static final String NAME = "variable";
22  
23      public Object evaluate(String expression, MuleMessage message)
24      {
25          // Variable is a shortcut for invocation properties
26          return ExpressionUtils.getProperty(expression, PropertyScope.INVOCATION, message);
27      }
28  
29      /**
30       * {@inheritDoc}
31       */
32      public String getName()
33      {
34          return NAME;
35      }
36  
37      /**
38       * {@inheritDoc}
39       */
40      public void setName(String name)
41      {
42          throw new UnsupportedOperationException();
43      }
44  }