@Test public void testParse() { String s = "n,o,foo\n" + "kyle,123456,emp123\n" + "jimmy,abcnum,cust09878"; HeaderColumnNameTranslateMappingStrategy<MockBean> strat = new HeaderColumnNameTranslateMappingStrategy<MockBean>(); strat.setType(MockBean.class); Map<String, String> map = new HashMap<String, String>(); map.put("n", "name"); map.put("o", "orderNumber"); map.put("foo", "id"); strat.setColumnMapping(map); CsvToBean<MockBean> csv = new CsvToBean<MockBean>(); List<MockBean> list = csv.parse(strat, new StringReader(s)); assertNotNull(list); assertTrue(list.size() == 2); MockBean bean = list.get(0); assertEquals("kyle", bean.getName()); assertEquals("123456", bean.getOrderNumber()); assertEquals("emp123", bean.getId()); }
public void setColumnMapping(Map<String, String> columnMapping) { for (Map.Entry<String,String> entry: columnMapping.entrySet()) { this.columnMapping.put(entry.getKey().toUpperCase(), entry.getValue()); } }
HeaderColumnNameTranslateMappingStrategy extends HeaderColumnNameMappingStrategy<T> { public void setColumnMapping(Map<String, String> columnMapping) { for (Map.Entry<String,String> entry: columnMapping.entrySet()) { this.columnMapping.put(entry.getKey().toUpperCase(), entry.getValue()); } } }
HeaderColumnNameTranslateMappingStrategy extends HeaderColumnNameMappingStrategy<T> { public void setColumnMapping(Map<String, String> columnMapping) { for (Map.Entry<String,String> entry: columnMapping.entrySet()) { this.columnMapping.put(entry.getKey().toUpperCase(), entry.getValue()); } }  }
HeaderColumnNameTranslateMappingStrategy extends HeaderColumnNameMappingStrategy<T> { public void setColumnMapping(Map<String, String> columnMapping) { for (Map.Entry<String,String> entry: columnMapping.entrySet()) { this.columnMapping.put(entry.getKey().toUpperCase(), entry.getValue()); } }  Map<String, String> getColumnMapping(); void setColumnMapping(Map<String, String> columnMapping); }
HeaderColumnNameTranslateMappingStrategy extends HeaderColumnNameMappingStrategy<T> { public void setColumnMapping(Map<String, String> columnMapping) { for (Map.Entry<String,String> entry: columnMapping.entrySet()) { this.columnMapping.put(entry.getKey().toUpperCase(), entry.getValue()); } }  Map<String, String> getColumnMapping(); void setColumnMapping(Map<String, String> columnMapping);  }