NIMSDK-AOS  10.9.80
V2NIMChatroomSelfMemberUpdateParams.java
浏览该文件的文档.
1 package com.netease.nimlib.sdk.v2.chatroom.params;
2 
3 import java.io.Serializable;
4 
5 /**
6  * 聊天室更新自己的成员参数
7  */
8 public class V2NIMChatroomSelfMemberUpdateParams implements Serializable {
9  /**
10  * 聊天室显示的昵称
11  * 为空表示不更新
12  * 不能为空串"", 返回参数错误
13  */
14  private String roomNick;
15  /**
16  * 头像
17  * 为空表示不更新
18  */
19  private String roomAvatar;
20  /**
21  * 成员扩展字段
22  * 为空表示不更新
23  * 长度限制: 4096字节
24  */
25  private String serverExtension;
26  /**
27  * 是否需要通知
28  * 默认为true
29  */
30  private Boolean notificationEnabled;
31  /**
32  * 本次操作生成的通知中的扩展字段
33  */
34  private String notificationExtension;
35  /**
36  * 更新信息持久化, 只针对固定成员身份生效
37  */
38  private Boolean persistence;
39 
41  }
42 
43  /**
44  * 获取聊天室显示的昵称
45  * @return 聊天室显示的昵称
46  */
47  public String getRoomNick() {
48  return roomNick;
49  }
50 
51  /**
52  * 获取头像
53  * @return 头像
54  */
55  public String getRoomAvatar() {
56  return roomAvatar;
57  }
58 
59  /**
60  * 获取成员扩展字段
61  * @return 成员扩展字段
62  */
63  public String getServerExtension() {
64  return serverExtension;
65  }
66 
67  /**
68  * 获取是否需要通知
69  * @return 是否需要通知
70  */
71  public boolean isNotificationEnabled() {
72  if (notificationEnabled == null){
73  return true;
74  }
75  return notificationEnabled;
76  }
77 
78  /**
79  * 获取本次操作生成的通知中的扩展字段
80  * @return 本次操作生成的通知中的扩展字段
81  */
82  public String getNotificationExtension() {
83  return notificationExtension;
84  }
85 
86  /**
87  * 是否更新信息持久化
88  * @return 是否更新信息持久化
89  */
90  public boolean isPersistence() {
91  if (persistence == null){
92  return false;
93  }
94  return persistence;
95  }
96 
97  /**
98  * 设置聊天室显示的昵称
99  * @param roomNick 聊天室显示的昵称
100  */
101  public void setRoomNick(String roomNick) {
102  this.roomNick = roomNick;
103  }
104 
105  /**
106  * 设置头像
107  * @param roomAvatar 头像
108  */
109  public void setRoomAvatar(String roomAvatar) {
110  this.roomAvatar = roomAvatar;
111  }
112 
113  /**
114  * 设置成员扩展字段
115  * @param serverExtension 成员扩展字段
116  */
117  public void setServerExtension(String serverExtension) {
118  this.serverExtension = serverExtension;
119  }
120 
121  /**
122  * 设置是否需要通知
123  * @param notificationEnabled 是否需要通知
124  */
125  public void setNotificationEnabled(boolean notificationEnabled) {
126  this.notificationEnabled = notificationEnabled;
127  }
128 
129  /**
130  * 设置本次操作生成的通知中的扩展字段
131  * @param notificationExtension 本次操作生成的通知中的扩展字段
132  */
133  public void setNotificationExtension(String notificationExtension) {
134  this.notificationExtension = notificationExtension;
135  }
136 
137  /**
138  * 设置更新信息持久化, 只针对固定成员身份生效
139  * @param persistence 更新信息持久化, 只针对固定成员身份生效
140  */
141  public void setPersistence(boolean persistence) {
142  this.persistence = persistence;
143  }
144 
145  public boolean isValid() {
146  if (roomNick != null && roomNick.isEmpty()) {
147  return false;
148  }
149  if (roomNick != null) {
150  return true;
151  }
152  if (roomAvatar != null) {
153  return true;
154  }
155  if (serverExtension != null) {
156  return true;
157  }
158  return false;
159  }
160 }
void setPersistence(boolean persistence)
设置更新信息持久化, 只针对固定成员身份生效
void setNotificationExtension(String notificationExtension)
设置本次操作生成的通知中的扩展字段
String getNotificationExtension()
获取本次操作生成的通知中的扩展字段