View Javadoc
1   package com.foxinmy.weixin4j.message.event;
2   
3   import javax.xml.bind.annotation.XmlElement;
4   
5   import com.foxinmy.weixin4j.type.EventType;
6   
7   /**
8    * 自定义菜单事件(view|click)
9    * 
10   * @className MenuEventMessage
11   * @author jinyu(foxinmy@gmail.com)
12   * @date 2014年4月6日
13   * @since JDK 1.6
14   * @see <a
15   *      href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140454&token=&lang=zh_CN">订阅号、服务号的菜单事件</a>
16   * @see <a
17   *      href="http://qydev.weixin.qq.com/wiki/index.php?title=%E6%8E%A5%E6%94%B6%E4%BA%8B%E4%BB%B6#.E4.B8.8A.E6.8A.A5.E8.8F.9C.E5.8D.95.E4.BA.8B.E4.BB.B6">企业号的菜单事件</a>
18   */
19  public class MenuEventMessage extends EventMessage {
20  
21  	private static final long serialVersionUID = -1049672447995366063L;
22  
23  	public MenuEventMessage() {
24  		super(EventType.click.name());
25  	}
26  
27  	public MenuEventMessage(EventType eventType) {
28  		super(eventType.name());
29  	}
30  
31  	/**
32  	 * 事件KEY值,与自定义菜单接口中KEY值对应
33  	 */
34  	@XmlElement(name = "EventKey")
35  	private String eventKey;
36  	/**
37  	 * 指菜单ID,如果是个性化菜单,则可以通过这个字段,知道是哪个规则的菜单被点击了。
38  	 */
39  	@XmlElement(name = "MenuID")
40  	private String menuId;
41  
42  	public String getEventKey() {
43  		return eventKey;
44  	}
45  
46  	public String getMenuId() {
47  		return menuId;
48  	}
49  
50  	@Override
51  	public String toString() {
52  		return "MenuEventMessage [eventKey=" + eventKey + ", menuId=" + menuId
53  				+ ", " + super.toString() + "]";
54  	}
55  }