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  import java.util.Map;
13  
14  /**
15   * Looks up the property on the message using the expression given. The expression can contain a comma-separated list
16   * of header names to lookup. A {@link java.util.Map} of key value pairs is returned.
17   *
18   * @see MessageHeadersListExpressionEvaluator
19   * @see org.mule.api.expression.ExpressionEvaluator
20   * @see DefaultExpressionManager
21   */
22  public class MessageHeadersExpressionEvaluator implements ExpressionEvaluator
23  {
24      public static final String NAME = "headers";
25  
26      public Object evaluate(String expression, MuleMessage message)
27      {
28          return ExpressionUtils.getPropertyWithScope(expression, message, Map.class);
29      }
30  
31      /**
32       * {@inheritDoc}
33       */
34      public String getName()
35      {
36          return NAME;
37      }
38  
39      /**
40       * {@inheritDoc}
41       */
42      public void setName(String name)
43      {
44          throw new UnsupportedOperationException();
45      }
46  }