View Javadoc
1   package com.foxinmy.weixin4j.message.event;
2   
3   import javax.xml.bind.annotation.XmlElement;
4   
5   import com.foxinmy.weixin4j.request.WeixinMessage;
6   import com.foxinmy.weixin4j.type.MessageType;
7   
8   /**
9    * 事件消息基类
10   * 
11   * @className EventMessage
12   * @author jinyu(foxinmy@gmail.com)
13   * @date 2014年4月6日
14   * @since JDK 1.6
15   * @see <a
16   *      href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140454&token=&lang=zh_CN">订阅号、服务号的事件推送</a>
17   * @see <a
18   *      href="http://qydev.weixin.qq.com/wiki/index.php?title=%E6%8E%A5%E6%94%B6%E4%BA%8B%E4%BB%B6">企业号的事件消息</a>
19   */
20  public class EventMessage extends WeixinMessage {
21  
22  	private static final long serialVersionUID = 7703667223814088865L;
23  
24  	protected EventMessage() {
25  		// jaxb requried
26  	}
27  
28  	public EventMessage(String eventType) {
29  		super(MessageType.event.name());
30  		this.eventType = eventType;
31  	}
32  
33  	/**
34  	 * 事件类型
35  	 * 
36  	 * @see com.foxinmy.weixin4j.type.EventType
37  	 */
38  	@XmlElement(name = "Event")
39  	private String eventType;
40  
41  	public String getEventType() {
42  		return eventType;
43  	}
44  
45  	@Override
46  	public String toString() {
47  		return "eventType=" + eventType + ", " + super.toString();
48  	}
49  }