我的Exchange正文是一个HashMap
public void processHeathData(@Body HashMap<String, Object> body)
{
CompleteTxnDetail competeTxnDetail = getCompeteTxn();
competeTxnDetail.setTxnDataMap(txnDataMap);
body.put("NOW", competeTxnDetail);
}
我在地图中放置了一个对象
public class CompleteTxnDetail {
public float getTotalFaliurePercentage()
{
Set<String> 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;
}
}
现在我在访问时无法访问
<choice>
<camel:when>
<simple>${body.NOW.getTotalFaliurePercentage} < 2</simple>
<bean ref="test" method="printMessage('One')" />
</camel:when>
<camel:otherwise>
<bean ref="test" method="printMessage('two')" />
</camel:otherwise>
答案 0 :(得分:1)
尝试
<simple>${body.get('NOW').getTotalFaliurePercentage()} < 2</simple>