title: Accessing object's method from Apache Camel
body: <p>My Exchange body is a HashMap</p>
  
  <pre><code>public void processHeathData(@Body HashMap&lt;String, Object&gt; body)
  {
  
      CompleteTxnDetail competeTxnDetail = getCompeteTxn();
      competeTxnDetail.setTxnDataMap(txnDataMap);
      body.put("NOW", competeTxnDetail);
  }
  </code></pre>
  
  <p>I put a object in map </p>
  
  <pre><code>public class CompleteTxnDetail {
  public float getTotalFaliurePercentage()
  {
      Set&lt;String&gt; keySet = txnDataMap.keySet();
      Integer totaltxn = getTotalTxn();
      if(totaltxn==0)
          return 0;
  
      Integer faliure=0;
      for(String key : keySet)
      {
          TransactionStatusDetailDTO dto = txnDataMap.get(key);
          faliure = faliure + dto.getFailedTxn();
      }
  
      float faliurePercentage = faliure*100f/totaltxn;
      return faliurePercentage;       
  }
  }
  </code></pre>
  
  <p>Now I am accessing this in when but unable to access</p>
  
  <pre><code>   &lt;choice&gt;
      &lt;camel:when&gt;
          &lt;simple&gt;${body.NOW.getTotalFaliurePercentage} &amp;lt; 2&lt;/simple&gt;
          &lt;bean ref="test" method="printMessage('One')" /&gt;
      &lt;/camel:when&gt;
      &lt;camel:otherwise&gt;
              &lt;bean ref="test" method="printMessage('two')" /&gt;
      &lt;/camel:otherwise&gt;
  </code></pre>