NIMSDK-AOS  9.19.0
MemberChangeAttachment.java
浏览该文件的文档.
1 package com.netease.nimlib.sdk.team.model;
2 
4 import com.netease.nimlib.util.JSONHelper;
5 
6 import org.json.JSONArray;
7 import org.json.JSONObject;
8 
9 import java.util.ArrayList;
10 
11 /**
12  * 群成员变动的通知消息实体。包括群成员变化和管理权限变化。<br>
13  * 所有类型的变动,操作者均为消息的fromAccount,被操作者为{@link #getTargets()}<br>
14  * 包括以下通知类型:<br>
15  *
16  * @see com.netease.nimlib.sdk.msg.constant.NotificationType#InviteMember
17  * @see com.netease.nimlib.sdk.msg.constant.NotificationType#KickMember
18  * @see com.netease.nimlib.sdk.msg.constant.NotificationType#PassTeamApply
19  * @see com.netease.nimlib.sdk.msg.constant.NotificationType#LeaveTeam
20  * @see com.netease.nimlib.sdk.msg.constant.NotificationType#TransferOwner
21  * @see com.netease.nimlib.sdk.msg.constant.NotificationType#SUPER_TEAM_INVITE
22  * @see com.netease.nimlib.sdk.msg.constant.NotificationType#SUPER_TEAM_LEAVE
23  * @see com.netease.nimlib.sdk.msg.constant.NotificationType#SUPER_TEAM_KICK
24  * <br>
25  * targets列表只包含新任拥有者的帐号
26  * @see com.netease.nimlib.sdk.msg.constant.NotificationType#AddTeamManager
27  * @see com.netease.nimlib.sdk.msg.constant.NotificationType#RemoveTeamManager
28  * @see com.netease.nimlib.sdk.msg.constant.NotificationType#AcceptInvite <br>
29  * targets列表只包含邀请者的用户帐号
30  */
32 
33  private static final String TAG_ACCOUNTS = "ids";
34  private static final String TAG_ACCOUNT = "id";
35 
36  /**
37  * 被操作的成员帐号列表
38  */
39  private ArrayList<String> targets;
40 
41  public ArrayList<String> getTargets() {
42  return targets;
43  }
44 
45  @Override
46  public void parse(JSONObject json) {
47  super.parse(json);
48 
49  if (json.has(TAG_ACCOUNTS)) {
50  JSONArray array = JSONHelper.getJSONArray(json, TAG_ACCOUNTS);
51  targets = new ArrayList<>(array.length());
52  for (int i = 0; i < array.length(); ++i) {
53  targets.add(JSONHelper.getString(array, i));
54  }
55  } else if (json.has(TAG_ACCOUNT)) {
56  targets = new ArrayList<>(1);
57  targets.add(JSONHelper.getString(json, TAG_ACCOUNT));
58  }
59  }
60 }
群成员变动的通知消息实体。包括群成员变化和管理权限变化。 所有类型的变动,操作者均为消息的fromAccount...