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