NIMSDK-AOS  9.19.0
SessionMsgDeleteOption.java
浏览该文件的文档.
1 package com.netease.nimlib.sdk.msg.model;
2 
3 import android.text.TextUtils;
4 
5 import com.netease.nimlib.biz.constant.ITalkService;
6 import com.netease.nimlib.push.packet.marshal.Property;
8 
9 public class SessionMsgDeleteOption {
10  /** 会话ID */
11  private String sessionId;
12  /** 会话类型 */
13  private SessionTypeEnum sessionType;
14  /** 删除操作的执行时间 */
15  private long time;
16  /** 扩展字段 */
17  private String ext;
18 
19  public SessionMsgDeleteOption(String sessionId, SessionTypeEnum sessionType, long time, String ext) {
20  this.sessionId = sessionId;
21  this.sessionType = sessionType;
22  this.time = time;
23  this.ext = ext;
24  }
25 
26  /**
27  * 通过Property生成实例
28  *
29  * @param property 符合条件的property
30  * @see com.netease.nimlib.biz.constant.ITalkService.SessionHistoryMsgsDeleteTag
31  * @return
32  */
33  public static SessionMsgDeleteOption fromProperty(Property property) {
34  String type = property.get(ITalkService.SessionHistoryMsgsDeleteTag.TYPE);
35  SessionTypeEnum sessionType;
36  String sessionId;
37  if (TextUtils.isEmpty(type) || "1".equals(type)) {
38  sessionType = SessionTypeEnum.P2P;
39  sessionId = property.get(ITalkService.SessionHistoryMsgsDeleteTag.OTHER_ACCID);
40  } else {
41  sessionType = SessionTypeEnum.Team;
42  sessionId = property.get(ITalkService.SessionHistoryMsgsDeleteTag.TO_TID);
43  }
44  long time = property.getLong(ITalkService.SessionHistoryMsgsDeleteTag.TIME);
45  String ext = property.get(ITalkService.SessionHistoryMsgsDeleteTag.EXT);
46 
47  return new SessionMsgDeleteOption(sessionId, sessionType, time, ext);
48  }
49 
50  public String getSessionId() {
51  return sessionId;
52  }
53 
55  return sessionType;
56  }
57 
58  public long getTime() {
59  return time;
60  }
61 
62  public String getExt() {
63  return ext;
64  }
65 }
static SessionMsgDeleteOption fromProperty(Property property)
通过Property生成实例
SessionMsgDeleteOption(String sessionId, SessionTypeEnum sessionType, long time, String ext)