NIMSDK-AOS  10.9.20
QChatSearchServerMemberByPageParam.java
浏览该文件的文档.
1 package com.netease.nimlib.sdk.qchat.param;
2 
3 import androidx.annotation.NonNull;
4 import androidx.annotation.Nullable;
5 import com.netease.nimlib.util.StringUtil;
6 
7 /**
8  * 检索服务器成员的接口入参
9  */
11  /**
12  * 检索关键字,目标检索昵称、账号,最大100个字符
13  */
14  @NonNull
15  private final String keyword;
16 
17  /**
18  * 服务器ID
19  */
20  private final long serverId;
21 
22  /**
23  * 检索返回的最大记录数,最大和默认都是100
24  */
25  @Nullable
26  private Integer limit;
27 
28  /**
29  * 构造函数
30  *
31  * @param keyword 检索关键字,目标检索昵称、账号,最大100个字符
32  * @param serverId 服务器ID
33  */
34  public QChatSearchServerMemberByPageParam(@NonNull String keyword, long serverId) {
35  this(keyword, serverId, null);
36  }
37 
38  /**
39  * 构造函数
40  *
41  * @param keyword 检索关键字,目标检索昵称、账号,最大100个字符
42  * @param serverId 服务器ID
43  * @param limit 检索返回的最大记录数,最大和默认都是100
44  */
45  public QChatSearchServerMemberByPageParam(@NonNull String keyword, long serverId, @Nullable Integer limit) {
46  this.keyword = keyword;
47  this.serverId = serverId;
48  this.limit = limit;
49  }
50 
51  /**
52  * 获取检索关键字
53  */
54  public String getKeyword() {
55  return keyword;
56  }
57 
58  /**
59  * 获取服务器ID
60  */
61  public long getServerId() {
62  return serverId;
63  }
64 
65  /**
66  * 获取检索返回的最大记录数
67  */
68  @Nullable
69  public Integer getLimit() {
70  return limit;
71  }
72 
73  /**
74  * 设置检索返回的最大记录数
75  */
76  public void setLimit(@Nullable Integer limit) {
77  this.limit = limit;
78  }
79 
80  /**
81  * 是否合法
82  */
83  public boolean isValid() {
84  if (StringUtil.isEmpty(keyword)) {
85  return false;
86  }
87  if (serverId <= 0) {
88  return false;
89  }
90  if (limit != null && limit < 0) {
91  return false;
92  }
93  return true;
94  }
95 
96  @Override
97  public String toString() {
98  return "QChatSearchServerMemberByPageParam{" +
99  "keyword='" + keyword + '\'' +
100  ", serverId=" + serverId +
101  ", limit=" + limit +
102  '}';
103  }
104 }
QChatSearchServerMemberByPageParam(@NonNull String keyword, long serverId)
构造函数
void setLimit(@Nullable Integer limit)
设置检索返回的最大记录数
QChatSearchServerMemberByPageParam(@NonNull String keyword, long serverId,@Nullable Integer limit)
构造函数