NIMSDK-AOS  9.19.10
QChatCreateChannelParam.java
浏览该文件的文档.
1 package com.netease.nimlib.sdk.qchat.param;
2 
3 import androidx.annotation.NonNull;
4 import com.netease.nimlib.BuildConfig;
5 import com.netease.nimlib.log.NimLog;
10 
11 /**
12  * "创建Channel"接口入参
13  */
14 public class QChatCreateChannelParam extends QChatAntiSpamConfigParam{
15 
16  private static final String TAG = "QChatCreateChannelParam";
17  /**
18  * 服务器id,必填
19  */
20  @NonNull
21  private final Long serverId;
22  /**
23  * 名称,必填
24  */
25  @NonNull
26  private final String name;
27  /**
28  * 频道类型,必填
29  */
30  @NonNull
31  private final Integer type;
32  /**
33  * 主题
34  */
35  private String topic;
36  /**
37  * 自定义扩展
38  */
39  private String custom;
40 
41  /**
42  * 查看模式
43  */
44  private QChatChannelMode viewMode;
45 
46  /**
47  * 频道分组id
48  */
49  private Long categoryId;
50  /**
51  * 频道同步模式
52  */
53  private QChatChannelSyncMode syncMode;
54 
55  /**
56  * 游客可见模式
57  */
58  private QChatVisitorMode visitorMode;
59 
60  /**
61  *
62  * @param serverId 服务器id
63  * @param name 名称
64  * @param type 频道类型,类型QChatChannelType,如果设置大于CustomChannel(100),请使用参数为int的重载方法
65  */
66  @SuppressWarnings("java:S2259")
67  public QChatCreateChannelParam(long serverId, @NonNull String name, @NonNull QChatChannelType type) {
68  if (type == null) {
69  String error = String.format("QChatCreateChannelParam QChatChannelType is %s", type);
70  if (BuildConfig.DEBUG) {
71  throw new IllegalArgumentException(error);
72  } else {
73  NimLog.e(TAG, error);
74  }
75  }
76 
77  this.serverId = serverId;
78  this.name = name;
79  this.type = type.getValue();
80  }
81 
82  /**
83  *
84  * @param serverId 服务器id
85  * @param name 名称
86  * @param customType 频道类型,类型int,可以设置大于CustomChannel(100)的自定义类型
87  */
88  private QChatCreateChannelParam(long serverId, @NonNull String name, int customType) {
89  this.serverId = serverId;
90  this.name = name;
91  this.type = customType;
92  }
93 
94  /**
95  * 设置主题
96  * @param topic
97  */
98  public void setTopic(String topic) {
99  this.topic = topic;
100  }
101 
102  /**
103  * 设置自定义扩展
104  * @param custom
105  */
106  public void setCustom(String custom) {
107  this.custom = custom;
108  }
109 
110  /**
111  * 获取服务器ID
112  * @return
113  */
114  @NonNull
115  public Long getServerId() {
116  return serverId;
117  }
118 
119  /**
120  * 获取名称
121  * @return
122  */
123  @NonNull
124  public String getName() {
125  return name;
126  }
127 
128  /**
129  * 获取主题
130  * @return
131  */
132  public String getTopic() {
133  return topic;
134  }
135 
136  /**
137  * 获取自定义扩展
138  * @return
139  */
140  public String getCustom() {
141  return custom;
142  }
143 
144  /**
145  * 获取频道类型
146  * @return
147  */
148  @NonNull
149  public Integer getType() {
150  return type;
151  }
152 
153  /**
154  * 获取频道查看模式
155  * @return
156  */
158  return viewMode;
159  }
160 
161  /**
162  * 设置频道查看模式
163  * @param viewMode
164  */
165  public void setViewMode(QChatChannelMode viewMode) {
166  this.viewMode = viewMode;
167  }
168 
169  /**
170  * 获取频道分组Id
171  * @return
172  */
173  public Long getCategoryId() {
174  return categoryId;
175  }
176 
177  /**
178  * 设置频道分组Id
179  * @param categoryId
180  */
181  public void setCategoryId(Long categoryId) {
182  this.categoryId = categoryId;
183  }
184 
185  /**
186  * 获取同步模式
187  * @return
188  */
190  return syncMode;
191  }
192 
193  /**
194  * 设置同步模式
195  * @param syncMode
196  */
197  public void setSyncMode(QChatChannelSyncMode syncMode) {
198  this.syncMode = syncMode;
199  }
200 
201  /**
202  * 获取游客可见模式
203  * @return
204  */
206  return visitorMode;
207  }
208 
209  /**
210  * 设置游客可见模式
211  * @param visitorMode
212  */
213  public void setVisitorMode(QChatVisitorMode visitorMode) {
214  this.visitorMode = visitorMode;
215  }
216 
217 }
void setSyncMode(QChatChannelSyncMode syncMode)
设置同步模式
QChatCreateChannelParam(long serverId, @NonNull String name, @NonNull QChatChannelType type)
void setVisitorMode(QChatVisitorMode visitorMode)
设置游客可见模式
void setViewMode(QChatChannelMode viewMode)
设置频道查看模式
QChatVisitorMode getVisitorMode()
获取游客可见模式