net.sf.weixinmp.model.Menu Maven / Gradle / Ivy
package net.sf.weixinmp.model;
import java.util.ArrayList;
import java.util.List;
public class Menu {
private List menus=new ArrayList();
public List getMenus() {
return menus;
}
public void addMenuButton(MenuButton mb){
menus.add(mb);
}
/**
* 给第i个菜单增加子菜单
* @param index
* @param mb
*/
public void addSubButton(int index, MenuButton mb){
if(index<0||index>2||index>menus.size()-1){
throw new IndexOutOfBoundsException("Weixin menu only support 3 first layer menu");
}
else {
menus.get(index).addSubMenuButton(mb);
}
}
public String toString() {
StringBuilder sb=new StringBuilder();
sb.append("{\"button\":[");
if(menus.size()!=0){
int i=0;
for(;i
© 2015 - 2025 Weber Informatics LLC | Privacy Policy