View Javadoc
1   package com.foxinmy.weixin4j.qy.message;
2   
3   import java.io.Serializable;
4   
5   import com.foxinmy.weixin4j.qy.type.ChatType;
6   import com.foxinmy.weixin4j.tuple.ChatTuple;
7   
8   /**
9    * 会话消息对象
10   *
11   * @className ChatMessage
12   * @author jinyu(foxinmy@gmail.com)
13   * @date 2015年8月1日
14   * @since JDK 1.6
15   * @see com.foxinmy.weixin4j.tuple.Text
16   * @see com.foxinmy.weixin4j.tuple.Image
17   * @see com.foxinmy.weixin4j.tuple.File
18   */
19  public class ChatMessage implements Serializable {
20  
21  	private static final long serialVersionUID = -4973029130270955777L;
22  
23  	/**
24  	 * 成员id|会话id
25  	 */
26  	private String targetId;
27  	/**
28  	 * 群聊|单聊
29  	 */
30  	private ChatType chatType;
31  	/**
32  	 * 发送人id
33  	 */
34  	private String senderId;
35  	/**
36  	 * 消息对象
37  	 */
38  	private ChatTuple chatTuple;
39  
40  	public ChatMessage(String targetId, ChatType chatType, String senderId,
41  			ChatTuple chatTuple) {
42  		this.targetId = targetId;
43  		this.chatType = chatType;
44  		this.senderId = senderId;
45  		this.chatTuple = chatTuple;
46  	}
47  
48  	public String getTargetId() {
49  		return targetId;
50  	}
51  
52  	public ChatType getChatType() {
53  		return chatType;
54  	}
55  
56  	public String getSenderId() {
57  		return senderId;
58  	}
59  
60  	public ChatTuple getChatTuple() {
61  		return chatTuple;
62  	}
63  
64  	@Override
65  	public String toString() {
66  		return "ChatMessage [targetId=" + targetId + ", chatType=" + chatType
67  				+ ", senderId=" + senderId + ", chatTuple=" + chatTuple + "]";
68  	}
69  }