Coverage Report - org.mule.expression.MessageHeaderExpressionEnricher
 
Classes in this File Line Coverage Branch Coverage Complexity
MessageHeaderExpressionEnricher
0%
0/10
0%
0/2
1.667
 
 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.ExpressionEnricher;
 11  
 import org.mule.api.transport.PropertyScope;
 12  
 
 13  0
 public class MessageHeaderExpressionEnricher implements ExpressionEnricher
 14  
 {
 15  
 
 16  
     public static final String NAME = "header";
 17  
 
 18  
     public void enrich(String expression, MuleMessage message, Object object)
 19  
     {
 20  0
         String propertyName = expression;
 21  0
         PropertyScope scope = ExpressionUtils.getScope(expression);
 22  0
         if (scope != null)
 23  
         {
 24  
             // cut-off leading scope and separator
 25  0
             propertyName = expression.substring(scope.getScopeName().length() + 1);
 26  
         }
 27  
         else
 28  
         {
 29  
             // default
 30  0
             scope = PropertyScope.OUTBOUND;
 31  
         }
 32  
 
 33  0
         message.setProperty(propertyName, object, scope);
 34  0
     }
 35  
 
 36  
     public String getName()
 37  
     {
 38  0
         return NAME;
 39  
     }
 40  
 
 41  
     public void setName(String name)
 42  
     {
 43  0
         throw new UnsupportedOperationException();
 44  
     }
 45  
 
 46  
 }