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