(String[] args)
| 12 | return new String(Files.readAllBytes(Paths.get(fileName))); |
| 13 | } |
| 14 | public static void main(String[] args) throws Exception { |
| 15 | |
| 16 | // 从文件读取配置表 |
| 17 | String data = null; |
| 18 | try { |
| 19 | data = readFileAsString("./cfg/table_gen.json"); |
| 20 | } catch (Exception e) { |
| 21 | e.printStackTrace(); |
| 22 | } |
| 23 | |
| 24 | // 表格数据 |
| 25 | Table tab; |
| 26 | |
| 27 | // 从json序列化出对象 |
| 28 | tab = JSON.parseObject(data, Table.class); |
| 29 | |
| 30 | if(tab == null){ |
| 31 | throw new Exception("parse table failed"); |
| 32 | } |
| 33 | |
| 34 | // 构建索引 |
| 35 | tab.BuildData(); |
| 36 | |
| 37 | // 测试输出 |
| 38 | for(Map.Entry<Integer, Table.ExampleData> def : tab.ExampleDataByID.entrySet()){ |
| 39 | System.out.println(def.getValue().Name); |
| 40 | } |
| 41 | } |
| 42 | } |
nothing calls this directly
no test coverage detected