Coverage Report - org.apache.camel.component.bean.DefaultParameterMappingStrategy
 
Classes in this File Line Coverage Branch Coverage Complexity
DefaultParameterMappingStrategy
44% 
N/A 
0
 
 1  
 /**
 2  
  * Licensed to the Apache Software Foundation (ASF) under one or more
 3  
  * contributor license agreements.  See the NOTICE file distributed with
 4  
  * this work for additional information regarding copyright ownership.
 5  
  * The ASF licenses this file to You under the Apache License, Version 2.0
 6  
  * (the "License"); you may not use this file except in compliance with
 7  
  * the License.  You may obtain a copy of the License at
 8  
  *
 9  
  *      http://www.apache.org/licenses/LICENSE-2.0
 10  
  *
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 16  
  */
 17  
 package org.apache.camel.component.bean;
 18  
 
 19  
 import java.util.Map;
 20  
 import java.util.concurrent.ConcurrentHashMap;
 21  
 
 22  
 import org.apache.camel.Exchange;
 23  
 import org.apache.camel.Expression;
 24  
 import org.apache.camel.Message;
 25  
 import org.apache.camel.builder.ExpressionBuilder;
 26  
 
 27  
 /**
 28  
  * Represents the strategy used to figure out how to map a message exchange to a POJO method invocation
 29  
  *
 30  
  * @version $Revision:$
 31  
  */
 32  
 public class DefaultParameterMappingStrategy implements ParameterMappingStrategy {
 33  6
     private Map<Class, Expression> parameterTypeToExpressionMap = new ConcurrentHashMap<Class, Expression>();
 34  
 
 35  6
     public DefaultParameterMappingStrategy() {
 36  6
     }
 37  
 
 38  
     public synchronized Expression getDefaultParameterTypeExpression(Class parameterType) {
 39  3
         return parameterTypeToExpressionMap.get(parameterType);
 40  
     }
 41  
 
 42  
     /**
 43  
      * Adds a default parameter type mapping to an expression
 44  
      */
 45  
     public synchronized void addParameterMapping(Class parameterType, Expression expression) {
 46  0
         parameterTypeToExpressionMap.put(parameterType, expression);
 47  0
     }
 48  
 
 49  
     /**
 50  
      * Creates an invocation on the given POJO using annotations to decide which method to invoke
 51  
      * and to figure out which parameters to use
 52  
      */
 53  
 /*
 54  
     public MethodInvocation createInvocation(Object pojo,
 55  
                                              BeanInfo beanInfo, 
 56  
                                              Exchange messageExchange,
 57  
                                              Endpoint pojoEndpoint) throws RuntimeCamelException {
 58  
         return beanInfo.createInvocation(pojo, messageExchange);
 59  
     }
 60  
 */
 61  
     public void loadDefaultRegistry() {
 62  0
         addParameterMapping(Exchange.class, ExpressionBuilder.exchangeExpression());
 63  0
         addParameterMapping(Message.class, ExpressionBuilder.inMessageExpression());
 64  0
     }
 65  
 }