public boolean set(Object rootObject, Object value) { return set(rootObject, value, true); }
public boolean set(Object rootObject, Object value) { return set(rootObject, value, true); }
public static boolean set(Object rootObject, String path, Object value) { JSONPath jsonpath = compile(path); return jsonpath.set(rootObject, value); }
public static boolean set(Object rootObject, String path, Object value) { JSONPath jsonpath = compile(path); return jsonpath.set(rootObject, value); }
@Override public void processExtra(Object object, String key, Object value) { JSONPath.set(object, "$.content", value); } };
@Override public void processExtra(Object object, String key, Object value) { if (key.equals("news_info")) { JSONArray news = ((JSONObject) value).getJSONArray("list"); List<MpArticle> newsList = new ArrayList<MpArticle>(news.size()); for (int i = 0; i < news.size(); i++) { newsList.add(JSON.parseObject(news.getString(i), MpArticle.class, ArticleExtraProcessor.global)); } JSONPath.set(object, "$.content", newsList); } else { JSONPath.set(object, "$.content", value); } } };
/** * 获取公众号当前使用的自定义菜单的配置,如果公众号是通过API调用设置的菜单,则返回菜单的开发配置, * 而如果公众号是在公众平台官网通过网站功能发布菜单,则本接口返回运营者设置的菜单配置。 * * @return 菜单集合 * @see {@link com.pentahohub.nexus.weixin.mp.service.MenuService#getMenu()} * @see <a * href="http://mp.weixin.qq.com/wiki/17/4dc4b0514fdad7a5fbbd477aa9aab5ed.html">获取自定义菜单配置</a> * @see com.pentahohub.nexus.weixin.domain.Button * @see com.pentahohub.nexus.weixin.mp.domain.MenuSetting * @see com.pentahohub.nexus.weixin.domain.tuple.MpArticle * @throws WeixinException */ public MenuSetting getMenuSetting() throws WeixinException { Token token = tokenHolder.getToken(); WeixinResponse response = weixinClient.get(String.format(MENU_GET_SELFMENU_URI, token.getAccessToken())); JSONObject result = response.getAsJson(); JSONArray buttons = result.getJSONObject("selfmenu_info").getJSONArray("button"); List<Button> buttonList = new ArrayList<Button>(buttons.size()); JSONObject buttonObj = null; for (int i = 0; i < buttons.size(); i++) { buttonObj = buttons.getJSONObject(i); if (buttonObj.containsKey("sub_button")) { JSONPath.set(buttonObj, "$.sub_button", buttonObj.getJSONObject("sub_button").getJSONArray("list")); } buttonList.add(JSON.parseObject(buttonObj.toJSONString(), Button.class, ButtonExtraProcessor.global)); } return new MenuSetting(result.getBooleanValue("is_menu_open"), buttonList); }