1 /*
2 * $Id: MessageHeaderExpressionEvaluator.java 20092 2010-11-05 19:17:25Z aperepel $
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
16 /**
17 * Looks up the property on the message using the property name given. If the call on the messgae returns null,
18 * parameters on the inbound endpoint will also be checked.
19 *
20 * @see MessageHeadersListExpressionEvaluator
21 * @see MessageHeadersExpressionEvaluator
22 * @see ExpressionEvaluator
23 * @see DefaultExpressionManager
24 */
25 public class MessageHeaderExpressionEvaluator implements ExpressionEvaluator
26 {
27 public static final String NAME = "header";
28
29 public Object evaluate(String expression, MuleMessage message)
30 {
31 return ExpressionUtils.getPropertyWithScope(expression, message);
32 }
33
34 /**
35 * {@inheritDoc}
36 */
37 public String getName()
38 {
39 return NAME;
40 }
41
42 /**
43 * {@inheritDoc}
44 */
45 public void setName(String name)
46 {
47 throw new UnsupportedOperationException();
48 }
49 }