NIMSDK-AOS  9.16.0
SystemMessage.java
浏览该文件的文档.
1 package com.netease.nimlib.sdk.msg.model;
2 
3 import android.text.TextUtils;
4 
5 import com.netease.nimlib.log.NimLog;
8 
9 import org.json.JSONException;
10 import org.json.JSONObject;
11 
12 import java.io.Serializable;
13 
17 public class SystemMessage implements Serializable {
18 
19  private static final String TAG = "SystemMessage";
20  private long messageId;
21 
22  private SystemMessageType type;
23 
24  private String fromAccount;
25 
26  private String targetId;
27 
28  private long time;
29 
30  private SystemMessageStatus status;
31 
32  private String content;
33 
34  private String attach;
35 
36  private Object attachObject;
37 
38  private boolean unread;
39 
40  private String customInfo;
41 
47  public long getMessageId() {
48  return messageId;
49  }
50 
56  public void setMessageId(long messageId) {
57  this.messageId = messageId;
58  }
59 
66  return type;
67  }
68 
74  public void setType(int type) {
75  this.type = SystemMessageType.typeOfValue(type);
76  }
77 
84  public String getFromAccount() {
85  return fromAccount;
86  }
87 
93  public void setFromAccount(String fromAccount) {
94  this.fromAccount = fromAccount;
95  }
96 
103  public String getTargetId() {
104  return targetId;
105  }
106 
112  public void setTargetId(String targetId) {
113  this.targetId = targetId;
114  }
115 
121  public long getTime() {
122  return time;
123  }
124 
130  public void setTime(long time) {
131  this.time = time;
132  }
133 
140  return status;
141  }
142 
148  public void setStatus(SystemMessageStatus status) {
149  this.status = status;
150  }
151 
158  public String getContent() {
159  return content;
160  }
161 
167  public void setContent(String content) {
168  this.content = content;
169  }
170 
177  public String getAttach() {
178  return attach;
179  }
180 
186  public void setAttach(String attach) {
187  if (!TextUtils.isEmpty(attach)) {
188  try {
189  JSONObject object = new JSONObject(attach);
190  customInfo = object.optString("attach");
191  } catch (JSONException e) {
192  e.printStackTrace();
193  NimLog.e(TAG, "get custom info err , attach = " + attach, e);
194  }
195  }
196  this.attach = attach;
197  }
198 
206  public Object getAttachObject() {
207  return attachObject;
208  }
209 
216  public void setAttachObject(Object object) {
217  this.attachObject = object;
218  }
219 
225  public boolean isUnread() {
226  return unread;
227  }
228 
234  public void setUnread(boolean unread) {
235  this.unread = unread;
236  }
237 
238 
244  public String getCustomInfo() {
245 
246  return customInfo;
247  }
248 }
Object getAttachObject()
获取系统通知附件内容解析后的对象。 对于第三方app自定义消息类型,该域可自行解析。 对于内置的系统通知...
String getCustomInfo()
获取自定义信息,目前只有拉人入群时可以设置
SystemMessageStatus getStatus()
获取系统通知的处理状态
void setAttachObject(Object object)
设置解析后的附件对象。 该字段和attach是独立的,以便第三方app缓存自己的附件对象。 ...
SystemMessageType getType()
获取系统通知类型
boolean isUnread()
判断该系统通知是否已读
void setMessageId(long messageId)
设置系统通知ID
void setUnread(boolean unread)
设置改系统通知已读/未读
void setType(int type)
设置系统通知类型
void setTime(long time)
设置系统通知的发出时间
void setTargetId(String targetId)
设置系统通知的目标ID
void setStatus(SystemMessageStatus status)
设置系统通知的处理状态
String getFromAccount()
该系统通知的发起方帐号。 例如:申请加入群的申请者,同意入群邀请的同意者
void setContent(String content)
设置系统通知的内容
void setAttach(String attach)
设置系统通知的附件内容。
String getTargetId()
获取系统通知的目标ID.
void setFromAccount(String fromAccount)
设置发起方帐号
String getAttach()
获取系统通知的附件内容。 该字段用于日后扩展
String getContent()
获取系统通知的内容。 例如:申请附言,拒绝理由
long getTime()
获取系统通知的发出时间,单位为ms