首页 > 代码库 > java的一段对象数据类型映射的代码
java的一段对象数据类型映射的代码
try { List<GateMetaPO> listGateInfoPO = majorGateReaderService.queryForAggregateBy( chapter); List<GateInfoPB> list = Lists.transform(listGateInfoPO, new Function<GateMetaPO, GateInfoPB>() { @Override public GateInfoPB apply(GateMetaPO input) { GateInfoPB.Builder builder = GateInfoPB.newBuilder(); builder.setChapter(input.getChapter()); builder.setGateCode(input.getGateCode()); builder.setExp(input.getExp()); builder.setMoney(input.getMoney()); builder.setIndex(input.getIndex()); List<EmemyList> ememyList = input.getEmemyList(); List<EmemyListPB> ememyListPB = Lists.transform(ememyList, new Function<EmemyList, EmemyListPB>() { @Override public EmemyListPB apply( EmemyList input) { EmemyListPB.Builder builder = EmemyListPB.newBuilder(); builder.setMode(input.getMode()); List<EmemyInfo> ememyInfo = input.getEmemyInfo(); List<EmemyInfoPB> ememyInfoPB = Lists.transform(ememyInfo, new Function<EmemyInfo, EmemyInfoPB>() { @Override public EmemyInfoPB apply(EmemyInfo input) { EmemyInfoPB.Builder builder = EmemyInfoPB.newBuilder(); builder.setEmemyCode(input.getEmemyCode()); builder.setIndex(Integer.parseInt(input.getEmemyIndex())); return builder.build(); } }); builder.addAllEmemyInfoPB(ememyInfoPB); return builder.build(); } }); builder.addAllEmemyListPB(ememyListPB); List<GoodsList> goodsList = input.getGoodsList(); List<GoodsListPB> goodsListPB = Lists.transform(goodsList, new Function<GoodsList, GoodsListPB>(){ @Override public GoodsListPB apply(GoodsList input) { // TODO Auto-generated method stub GoodsListPB.Builder builder = GoodsListPB.newBuilder(); builder.setMode(input.getMode()); List<GoodsInfo> goodsInfo = input.getGoodsInfo(); List<GoodsInfoPB> goodsInfoPB = Lists.transform(goodsInfo, new Function<GoodsInfo, GoodsInfoPB>(){ @Override public GoodsInfoPB apply(GoodsInfo input) { GoodsInfoPB.Builder builder = GoodsInfoPB.newBuilder(); builder.setGoodsCode(input.getGoodsCode()); builder.setMaxCounts(input.getMaxCounts()); builder.setDropRate(input.getDropRate()); return builder.build(); } }); builder.addAllGoodsInfoPB(goodsInfoPB); return builder.build(); } }); builder.addAllGoodsListPB(goodsListPB); List<GateState> gateState = input.getGateStateList(); List<GateStatePB> gateStatePB = Lists.transform(gateState, new Function<GateState, GateStatePB>(){ @Override public GateStatePB apply(GateState input) { GateStatePB.Builder builder = GateStatePB.newBuilder(); builder.setMode(input.getMode()); builder.setBattleState(input.getBattleState()); builder.setScore(input.getScore()); builder.setCounts(input.getCounts()); builder.setTotal(input.getTotal()); return builder.build(); } }); builder.addAllGateStatePB(gateStatePB); return builder.build(); } }); builder.setResultCode(1).addAllGateInfo(list); } catch (Exception e) { }
java的一段对象数据类型映射的代码
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。