添加菜单API的支持
This commit is contained in:
90
src/main/java/chanjarster/weixin/bean/WxMenu.java
Normal file
90
src/main/java/chanjarster/weixin/bean/WxMenu.java
Normal file
@@ -0,0 +1,90 @@
|
||||
package chanjarster.weixin.bean;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import chanjarster.weixin.util.WxGsonBuilder;
|
||||
|
||||
/**
|
||||
* 公众号菜单
|
||||
* @author chanjarster
|
||||
*
|
||||
*/
|
||||
public class WxMenu {
|
||||
|
||||
protected List<WxMenuButton> button = new ArrayList<WxMenuButton>();
|
||||
|
||||
public List<WxMenuButton> getButton() {
|
||||
return button;
|
||||
}
|
||||
|
||||
public void setButton(List<WxMenuButton> button) {
|
||||
this.button = button;
|
||||
}
|
||||
|
||||
public String toJson() {
|
||||
return WxGsonBuilder.create().toJson(this);
|
||||
}
|
||||
|
||||
public static WxMenu fromJson(String json) {
|
||||
return WxGsonBuilder.create().fromJson(json, WxMenu.class);
|
||||
}
|
||||
|
||||
public static WxMenu fromJson(InputStream is) {
|
||||
return WxGsonBuilder.create().fromJson(new InputStreamReader(is), WxMenu.class);
|
||||
}
|
||||
|
||||
public static class WxMenuButton {
|
||||
|
||||
protected String type;
|
||||
protected String name;
|
||||
protected String key;
|
||||
protected String url;
|
||||
|
||||
protected List<WxMenuButton> sub_button = new ArrayList<WxMenuButton>();
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public List<WxMenuButton> getSub_button() {
|
||||
return sub_button;
|
||||
}
|
||||
|
||||
public void setSub_button(List<WxMenuButton> sub_button) {
|
||||
this.sub_button = sub_button;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user