NIMSDK-AOS  9.16.0
ChatRoomQueueChangeAttachment.java
浏览该文件的文档.
1 package com.netease.nimlib.sdk.chatroom.model;
2 
4 import com.netease.nimlib.util.JSONHelper;
5 
6 import org.json.JSONObject;
7 
8 import java.util.Map;
9 
15 
16  private static final String TAG_QUEUE_CHANGE = "queueChange";
17  private static final String TAG_CONTENT = "content";
18  private static final String TAG_KEY = "key";
19  private static final String TAG_TYPE = "_e";
20  private static final String TAG_KEYS = "kvObject";
21  private Map<String, String> contentMap;
22 
23  private ChatRoomQueueChangeType chatRoomQueueChangeType;
24 
25  private String key;
26 
27  private String content;
28 
30  return chatRoomQueueChangeType;
31  }
32 
33  public String getKey() {
34  return key;
35  }
36 
37  public String getContent() {
38  return content;
39  }
40 
41  public Map<String, String> getContentMap() {
42  return contentMap;
43  }
44 
45 
46  @Override
47  public void parse(JSONObject json) {
48  super.parse(json);
49  if (json.has(TAG_QUEUE_CHANGE)) {
50  String queueChange = JSONHelper.getString(json, TAG_QUEUE_CHANGE);
51  JSONObject jsonObject = JSONHelper.parse(queueChange);
52  if (jsonObject.has(TAG_TYPE)) {
53  chatRoomQueueChangeType = ChatRoomQueueChangeType.valueOf(JSONHelper.getString(jsonObject, TAG_TYPE));
54  }
55 
56  if (jsonObject.has(TAG_KEY)) {
57  key = JSONHelper.getString(jsonObject, TAG_KEY);
58  }
59 
60  if (jsonObject.has(TAG_CONTENT)) {
61  content = JSONHelper.getString(jsonObject, TAG_CONTENT);
62  }
63  if (jsonObject.has(TAG_KEYS)) {
64  String content = JSONHelper.getString(jsonObject, TAG_KEYS);
65  JSONObject contentJson = JSONHelper.parse(content);
66  contentMap = JSONHelper.parseMapFromJsonObject(contentJson);
67  }
68  }
69  }
70 }