title: How to get generic types as exchange input body rather than casting?
body: <p>In <strong>Apache camel</strong> it's possible to get message body by it's own type by passing it's type into <code>exchange.getIn().getBody(Class&lt;T&gt; type)</code>. Lets say we want to get message body as <code>String</code> here is the example as following:</p>
  
  <pre><code>String body = exchange.getIn().getBody(String.class);
  </code></pre>
  
  <p>In case of <code>Generic</code> or <code>Parameterized</code> types message, how do we get the object by it's own type rather than traditional object type casting. Here the pseudo code snippet for your realization:</p>
  
  <pre><code>package com.chorke.hmis.fusion.epoint;
  
  import java.util.ArrayList;
  import java.util.HashMap;
  
  import org.apache.camel.Exchange;
  import org.springframework.stereotype.Component;
  
  @Component("chorkeProcessor")
  public class ChorkeProcessorImpl implements ChorkeProcessor{
  
      @Override
      public void process(Exchange exchange) throws Exception {
          ArrayList&lt;HashMap&lt;String, Object&gt;&gt; list = null;
          list = exchange.getIn().getBody(ArrayList&lt;HashMap&lt;String, Object&gt;&gt;.class);
  
          for (HashMap&lt;String, Object&gt; map : list) {
              for (String key : map.keySet()) {
                 Object value= map.get(key);
                 //TODO
              }
          }
      }
  }
  </code></pre>
  
  <p>Our expectation is as like as the example.</p>