me.chanjar.weixin.mp.bean.menu.WxMpMenu Maven / Gradle / Ivy
package me.chanjar.weixin.mp.bean.menu;
import java.io.Serializable;
import java.util.List;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import me.chanjar.weixin.common.bean.menu.WxMenuButton;
import me.chanjar.weixin.common.bean.menu.WxMenuRule;
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
/**
*
* 公众号专用的菜单类,可能包含个性化菜单
* Created by Binary Wang on 2017-1-17.
*
*
* @author Binary Wang
*/
@Data
public class WxMpMenu implements Serializable {
private static final long serialVersionUID = -5794350513426702252L;
@SerializedName("menu")
private WxMpConditionalMenu menu;
@SerializedName("conditionalmenu")
private List conditionalMenu;
public static WxMpMenu fromJson(String json) {
return WxGsonBuilder.create().fromJson(json, WxMpMenu.class);
}
@Override
public String toString() {
return this.toJson();
}
public String toJson() {
return WxGsonBuilder.create().toJson(this);
}
@Data
public static class WxMpConditionalMenu implements Serializable {
private static final long serialVersionUID = -2279946921755382289L;
@SerializedName("button")
private List buttons;
@SerializedName("matchrule")
private WxMenuRule rule;
@SerializedName("menuid")
private String menuId;
@Override
public String toString() {
return WxMpGsonBuilder.create().toJson(this);
}
}
}