NIMSDK-AOS  9.19.10
ChatRoomKickOutEvent.java
浏览该文件的文档.
1 package com.netease.nimlib.sdk.chatroom.model;
2 
3 import com.netease.nimlib.biz.constant.IChatRoomService;
4 
5 import java.util.Map;
6 
7 /**
8  * 聊天室被踢出事件
9  */
10 public class ChatRoomKickOutEvent {
11 
12  public enum ChatRoomKickOutReason {
13  /**
14  * 未知(出错情况)
15  */
16  UNKNOWN(-1),
17 
18  /**
19  * 聊天室已经被解散
20  */
21  CHAT_ROOM_INVALID(IChatRoomService.KickReason.CHAT_ROOM_INVALID),
22 
23  /**
24  * 被管理员踢出
25  */
26  KICK_OUT_BY_MANAGER(IChatRoomService.KickReason.KICK_BY_MANAGER),
27 
28  /**
29  * 被其他端踢出
30  */
31  KICK_OUT_BY_CONFLICT_LOGIN(IChatRoomService.KickReason.KICK_BY_CONFLICT_LOGIN),
32 
33  /**
34  * 当前连接状态异常
35  */
36  ILLEGAL_STAT(IChatRoomService.KickReason.ILLEGAL_STAT),
37 
38  /**
39  * 被加黑了
40  */
41  BE_BLACKLISTED(IChatRoomService.KickReason.BE_BLACKLISTED);
42 
43  private int value;
44 
45  ChatRoomKickOutReason(int value) {
46  this.value = value;
47  }
48 
49  public int getValue() {
50  return value;
51  }
52 
53  public static ChatRoomKickOutReason typeOfValue(int value) {
54  for (ChatRoomKickOutReason e : values()) {
55  if (e.getValue() == value) {
56  return e;
57  }
58  }
59  return UNKNOWN;
60  }
61  }
62 
63  private String roomId;
64  private ChatRoomKickOutReason reason;
65  private Map<String, Object> extension;
66 
67  public ChatRoomKickOutEvent(String roomId, int reason, Map<String, Object> extension) {
68  this.roomId = roomId;
69  this.reason = ChatRoomKickOutReason.typeOfValue(reason);
70  this.extension = extension;
71  }
72 
73  public String getRoomId() {
74  return roomId;
75  }
76 
78  return reason;
79  }
80 
81  public Map<String, Object> getExtension() {
82  return extension;
83  }
84 }
ChatRoomKickOutEvent(String roomId, int reason, Map< String, Object > extension)