@Test public void testGetCategory() throws Exception { List<WxMaCategory> categories = wxService.getCodeService().getCategory(); System.out.println(String.valueOf(categories)); }
@Override public List<WxMaCategory> getCategory() throws WxErrorException { String responseContent = this.wxMaService.get(GET_CATEGORY_URL, null); JsonObject jsonObject = JSON_PARSER.parse(responseContent).getAsJsonObject(); boolean hasCategoryList = jsonObject.has("category_list"); if (hasCategoryList) { return WxMaGsonBuilder.create().fromJson(jsonObject.getAsJsonArray("category_list"), new TypeToken<List<WxMaCategory>>() { }.getType()); } else { return null; } }
WxMaCodeServiceImpl implements WxMaCodeService { @Override public List<WxMaCategory> getCategory() throws WxErrorException { String responseContent = this.wxMaService.get(GET_CATEGORY_URL, null); JsonObject jsonObject = JSON_PARSER.parse(responseContent).getAsJsonObject(); boolean hasCategoryList = jsonObject.has("category_list"); if (hasCategoryList) { return WxMaGsonBuilder.create().fromJson(jsonObject.getAsJsonArray("category_list"), new TypeToken<List<WxMaCategory>>() { }.getType()); } else { return null; } } }
WxMaCodeServiceImpl implements WxMaCodeService { @Override public List<WxMaCategory> getCategory() throws WxErrorException { String responseContent = this.wxMaService.get(GET_CATEGORY_URL, null); JsonObject jsonObject = JSON_PARSER.parse(responseContent).getAsJsonObject(); boolean hasCategoryList = jsonObject.has("category_list"); if (hasCategoryList) { return WxMaGsonBuilder.create().fromJson(jsonObject.getAsJsonArray("category_list"), new TypeToken<List<WxMaCategory>>() { }.getType()); } else { return null; } } WxMaCodeServiceImpl(WxMaService wxMaService); }
WxMaCodeServiceImpl implements WxMaCodeService { @Override public List<WxMaCategory> getCategory() throws WxErrorException { String responseContent = this.wxMaService.get(GET_CATEGORY_URL, null); JsonObject jsonObject = JSON_PARSER.parse(responseContent).getAsJsonObject(); boolean hasCategoryList = jsonObject.has("category_list"); if (hasCategoryList) { return WxMaGsonBuilder.create().fromJson(jsonObject.getAsJsonArray("category_list"), new TypeToken<List<WxMaCategory>>() { }.getType()); } else { return null; } } WxMaCodeServiceImpl(WxMaService wxMaService); @Override void commit(WxMaCodeCommitRequest commitRequest); @Override byte[] getQrCode(String path); @Override List<WxMaCategory> getCategory(); @Override List<String> getPage(); @Override long submitAudit(WxMaCodeSubmitAuditRequest auditRequest); @Override WxMaCodeAuditStatus getAuditStatus(long auditId); @Override WxMaCodeAuditStatus getLatestAuditStatus(); @Override void release(); @Override void changeVisitStatus(String action); @Override void revertCodeRelease(); @Override WxMaCodeVersionDistribution getSupportVersion(); @Override void setSupportVersion(String version); @Override void undoCodeAudit(); }
WxMaCodeServiceImpl implements WxMaCodeService { @Override public List<WxMaCategory> getCategory() throws WxErrorException { String responseContent = this.wxMaService.get(GET_CATEGORY_URL, null); JsonObject jsonObject = JSON_PARSER.parse(responseContent).getAsJsonObject(); boolean hasCategoryList = jsonObject.has("category_list"); if (hasCategoryList) { return WxMaGsonBuilder.create().fromJson(jsonObject.getAsJsonArray("category_list"), new TypeToken<List<WxMaCategory>>() { }.getType()); } else { return null; } } WxMaCodeServiceImpl(WxMaService wxMaService); @Override void commit(WxMaCodeCommitRequest commitRequest); @Override byte[] getQrCode(String path); @Override List<WxMaCategory> getCategory(); @Override List<String> getPage(); @Override long submitAudit(WxMaCodeSubmitAuditRequest auditRequest); @Override WxMaCodeAuditStatus getAuditStatus(long auditId); @Override WxMaCodeAuditStatus getLatestAuditStatus(); @Override void release(); @Override void changeVisitStatus(String action); @Override void revertCodeRelease(); @Override WxMaCodeVersionDistribution getSupportVersion(); @Override void setSupportVersion(String version); @Override void undoCodeAudit();  }