当前位置: 首页>>代码示例>>Java>>正文


Java WxMenuBtnEntity类代码示例

本文整理汇总了Java中org.hamster.weixinmp.dao.entity.menu.WxMenuBtnEntity的典型用法代码示例。如果您正苦于以下问题:Java WxMenuBtnEntity类的具体用法?Java WxMenuBtnEntity怎么用?Java WxMenuBtnEntity使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


WxMenuBtnEntity类属于org.hamster.weixinmp.dao.entity.menu包,在下文中一共展示了WxMenuBtnEntity类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: recursiveParse

import org.hamster.weixinmp.dao.entity.menu.WxMenuBtnEntity; //导入依赖的package包/类
public JsonObject recursiveParse(WxMenuBtnEntity parentEntity) {
	JsonObject parent = new JsonObject();
	parent.addProperty("type", parentEntity.getType());
	parent.addProperty("name", parentEntity.getName());

	WxMenuBtnTypeEnum type = WxMenuBtnTypeEnum.valueOf(parentEntity
			.getType());
	switch (type) {
	case CLICK:
		parent.addProperty("key", parentEntity.getKey());
		break;
	case VIEW:
		parent.addProperty("url", parentEntity.getUrl());
		break;
	default:
		break;
	}
	if (!CollectionUtils.isEmpty(parentEntity.getSubButtons())) {
		JsonArray children = new JsonArray();
		for (WxMenuBtnEntity child : parentEntity.getSubButtons()) {
			children.add(recursiveParse(child));
		}
		parent.add("sub_button", children);
	}
	return parent;
}
 
开发者ID:Charlemin,项目名称:weixin-mp-java-master,代码行数:27,代码来源:WxMenuBtnSerializer.java

示例2: menuCreate

import org.hamster.weixinmp.dao.entity.menu.WxMenuBtnEntity; //导入依赖的package包/类
public WxRespCode menuCreate(String accessToken, List<WxMenuBtnEntity> entities)
		throws WxException {
	Map<String, String> params = getAccessTokenParams(accessToken);

	GsonBuilder gsonBuilder = new GsonBuilder();
	gsonBuilder.registerTypeAdapter(WxUserEntity.class,
			new WxMenuBtnSerializer());
	Gson gson = gsonBuilder.create();
	
	WxMenuCreateJson wrapper = new WxMenuCreateJson(entities);
	wrapper.setButton(entities);

	try {
		return sendRequest(config.getMenuCreateUrl(), HttpMethod.POST, params,
				new StringEntity(gson.toJson(wrapper)),
				WxRespCode.class);
	} catch (UnsupportedEncodingException e) {
		throw new WxException(e);
	}
}
 
开发者ID:Charlemin,项目名称:weixin-mp-java-master,代码行数:21,代码来源:WxMenuService.java

示例3: menuCreate

import org.hamster.weixinmp.dao.entity.menu.WxMenuBtnEntity; //导入依赖的package包/类
public WxRespCode menuCreate(String accessToken, List<WxMenuBtnEntity> entities)
		throws WxException {
	Map<String, String> params = getAccessTokenParams(accessToken);

	GsonBuilder gsonBuilder = new GsonBuilder();
	gsonBuilder.registerTypeAdapter(WxUserEntity.class,
			new WxMenuBtnSerializer());
	Gson gson = gsonBuilder.create();
	
	WxMenuCreateJson wrapper = new WxMenuCreateJson();
	wrapper.setButton(entities);

	try {
		return sendRequest(config.getMenuCreateUrl(), HttpMethod.POST, params,
				new StringEntity(gson.toJson(wrapper)),
				WxRespCode.class);
	} catch (UnsupportedEncodingException e) {
		throw new WxException(e);
	}
}
 
开发者ID:honeyzhaoAliyun,项目名称:WeixinMultiPlatform,代码行数:21,代码来源:WxMenuService.java

示例4: serialize

import org.hamster.weixinmp.dao.entity.menu.WxMenuBtnEntity; //导入依赖的package包/类
public JsonElement serialize(WxMenuBtnEntity src, Type typeOfSrc,
		JsonSerializationContext context) {
	return recursiveParse(src);
}
 
开发者ID:Charlemin,项目名称:weixin-mp-java-master,代码行数:5,代码来源:WxMenuBtnSerializer.java

示例5: toMenuCreateReqBody

import org.hamster.weixinmp.dao.entity.menu.WxMenuBtnEntity; //导入依赖的package包/类
public static final String toMenuCreateReqBody(List<WxMenuBtnEntity> wxMenuBtnList) {
	Gson gson = new Gson();
	return gson.toJson(new WxMenuCreateJson(wxMenuBtnList));
}
 
开发者ID:Charlemin,项目名称:weixin-mp-java-master,代码行数:5,代码来源:WxJsonUtil.java

示例6: menuGet

import org.hamster.weixinmp.dao.entity.menu.WxMenuBtnEntity; //导入依赖的package包/类
public List<WxMenuBtnEntity> menuGet(String accessToken) throws WxException {
	Map<String, String> params = getAccessTokenParams(accessToken);

	return sendRequest(config.getMenuGetUrl(), HttpMethod.GET, params, null,
			WxMenuGetJson.class).getMenu().getButton();
}
 
开发者ID:Charlemin,项目名称:weixin-mp-java-master,代码行数:7,代码来源:WxMenuService.java

示例7: toMenuCreateReqBody

import org.hamster.weixinmp.dao.entity.menu.WxMenuBtnEntity; //导入依赖的package包/类
public static final String toMenuCreateReqBody(List<WxMenuBtnEntity> wxMenuBtnList) {
	Gson gson = new Gson();
	WxMenuCreateJson wxMenuCreateJson = new WxMenuCreateJson();
	wxMenuCreateJson.setButton(wxMenuBtnList);
	return gson.toJson(wxMenuCreateJson);
}
 
开发者ID:honeyzhaoAliyun,项目名称:WeixinMultiPlatform,代码行数:7,代码来源:WxJsonUtil.java

示例8: getButton

import org.hamster.weixinmp.dao.entity.menu.WxMenuBtnEntity; //导入依赖的package包/类
public List<WxMenuBtnEntity> getButton() {
	return button;
}
 
开发者ID:honeyzhaoAliyun,项目名称:WeixinMultiPlatform,代码行数:4,代码来源:WxMenuCreateJson.java

示例9: setButton

import org.hamster.weixinmp.dao.entity.menu.WxMenuBtnEntity; //导入依赖的package包/类
public void setButton(List<WxMenuBtnEntity> button) {
	this.button = button;
}
 
开发者ID:honeyzhaoAliyun,项目名称:WeixinMultiPlatform,代码行数:4,代码来源:WxMenuCreateJson.java

示例10: WxMenuCreateJson

import org.hamster.weixinmp.dao.entity.menu.WxMenuBtnEntity; //导入依赖的package包/类
public WxMenuCreateJson(List<WxMenuBtnEntity> button) {
	super();
	this.button = button;
}
 
开发者ID:honeyzhaoAliyun,项目名称:WeixinMultiPlatform,代码行数:5,代码来源:WxMenuCreateJson.java


注:本文中的org.hamster.weixinmp.dao.entity.menu.WxMenuBtnEntity类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。