
net.sf.weixinmp.model.MenuButton Maven / Gradle / Ivy
The newest version!
package net.sf.weixinmp.model;
import java.util.ArrayList;
import java.util.List;
public class MenuButton {
private String name;
private String type;
private String key;
private String mediaId;
private String url;
private List subButtons=new ArrayList();
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getMediaId() {
return mediaId;
}
public void setMediaId(String mediaId) {
this.mediaId = mediaId;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public List getSubButtons() {
return subButtons;
}
public void addSubMenuButton(MenuButton mb){
if(mb.subButtons.size()>0){
throw new UnsupportedOperationException("Weixin Only Support two layers of menu!");
}
else {
this.subButtons.add(mb);
}
}
public String toString() {
StringBuilder sb=new StringBuilder();
sb.append("{");
if(subButtons.size()>0){
sb.append("\"name\":\"").append(this.name==null?"":this.name).append("\",");
sb.append("\"sub_button\":[");
int i=0;
for(;i
© 2015 - 2025 Weber Informatics LLC | Privacy Policy