2015-03-24 116 views
0

寫@FixedLengthRecord收集到一個平面文件我用註釋的POJO列表@FixedLengthRecord如何使用Apache的駱駝

,我使用

<bindy id="bindyFixedLengthFormat" type="Fixed" packages="xx"> 

但我不能將所有數據寫入平面文件。我知道csv格式在這種情況下起作用。

回答

0

我想我得到了一個解決方案。我明確創建了一張地圖列表,然後編組它

List<Map<String, Object>> pojoListMap = new ArrayList<Map<String, Object>>(); 
     Map<String, Object> pojoMap = null; 
     for(POJO pojo : pojoList) { 
      pojoMap = new HashMap<String, Object>(); 
      pojoMap.put(pojo.getClass().getName(), pojo); 
      pojoListMap.add(pracMap); 
     }