NIMSDK-AOS  9.16.0
QChatSearchChannelByPageParam.java
浏览该文件的文档.
1 package com.netease.nimlib.sdk.qchat.param;
2 
3 import androidx.annotation.NonNull;
4 import androidx.annotation.Nullable;
6 import com.netease.nimlib.util.StringUtil;
7 
12 
16  @NonNull
17  private final String keyword;
18 
22  private final boolean asc;
23 
27  @Nullable
28  private Long startTime;
29 
33  @Nullable
34  private Long endTime;
35 
39  @Nullable
40  private Integer limit;
41 
45  @Nullable
46  private Long serverId;
47 
51  private QChatChannelSearchSortEnum sort;
52 
56  private String cursor;
57 
64  public QChatSearchChannelByPageParam(@NonNull String keyword, boolean asc) {
65  this(keyword, asc, null, null, null, null);
66  }
67 
78  public QChatSearchChannelByPageParam(@NonNull String keyword, boolean asc, @Nullable Long startTime, @Nullable Long endTime,
79  @Nullable Integer limit, @Nullable Long serverId) {
80  this.keyword = keyword;
81  this.asc = asc;
82  this.startTime = startTime;
83  this.endTime = endTime;
84  this.limit = limit;
85  this.serverId = serverId;
86  }
87 
99  public QChatSearchChannelByPageParam(@NonNull String keyword, boolean asc, @Nullable Long startTime, @Nullable Long endTime,
100  @Nullable Integer limit, @Nullable Long serverId,@Nullable String cursor) {
101  this.keyword = keyword;
102  this.asc = asc;
103  this.startTime = startTime;
104  this.endTime = endTime;
105  this.limit = limit;
106  this.serverId = serverId;
107  this.cursor = cursor;
108  }
121  public QChatSearchChannelByPageParam(@NonNull String keyword, boolean asc, @Nullable Long startTime, @Nullable Long endTime,
122  @Nullable Integer limit, @Nullable Long serverId, QChatChannelSearchSortEnum sort,@Nullable String cursor) {
123  this.keyword = keyword;
124  this.asc = asc;
125  this.startTime = startTime;
126  this.endTime = endTime;
127  this.limit = limit;
128  this.serverId = serverId;
129  this.sort = sort;
130  this.cursor = cursor;
131  }
132 
136  public String getKeyword() {
137  return keyword;
138  }
139 
143  public boolean isAsc() {
144  return asc;
145  }
146 
150  @Nullable
151  public Long getStartTime() {
152  return startTime;
153  }
154 
159  public void setStartTime(@Nullable Long startTime) {
160  this.startTime = startTime;
161  }
162 
166  @Nullable
167  public Long getEndTime() {
168  return endTime;
169  }
170 
175  public void setEndTime(@Nullable Long endTime) {
176  this.endTime = endTime;
177  }
178 
182  @Nullable
183  public Integer getLimit() {
184  return limit;
185  }
186 
191  public void setLimit(@Nullable Integer limit) {
192  this.limit = limit;
193  }
194 
198  @Nullable
199  public Long getServerId() {
200  return serverId;
201  }
202 
207  public void setServerId(@Nullable Long serverId) {
208  this.serverId = serverId;
209  }
210 
216  return sort;
217  }
218 
224  this.sort = sort;
225  }
226 
231  public String getCursor() {
232  return cursor;
233  }
234 
239  public void setCursor(String cursor) {
240  this.cursor = cursor;
241  }
242 
246  public boolean isValid() {
247  if (StringUtil.isEmpty(keyword)) {
248  return false;
249  }
250  if (startTime != null && startTime < 0) {
251  return false;
252  }
253  if (endTime != null && endTime < 0) {
254  return false;
255  }
256  if (limit != null && limit < 0) {
257  return false;
258  }
259  if (serverId != null && serverId <= 0) {
260  return false;
261  }
262  return true;
263  }
264 
265  @Override
266  public String toString() {
267  return "QChatSearchChannelByPageParam{" +
268  "keyword='" + keyword + '\'' +
269  ", asc=" + asc +
270  ", startTime=" + startTime +
271  ", endTime=" + endTime +
272  ", limit=" + limit +
273  ", serverId=" + serverId +
274  '}';
275  }
276 }
QChatSearchChannelByPageParam(@NonNull String keyword, boolean asc, @Nullable Long startTime, @Nullable Long endTime, @Nullable Integer limit, @Nullable Long serverId, @Nullable String cursor)
构造函数
void setLimit(@Nullable Integer limit)
设置检索返回的最大记录数
QChatSearchChannelByPageParam(@NonNull String keyword, boolean asc)
构造函数
void setStartTime(@Nullable Long startTime)
设置查询时间范围的开始时间
void setSort(QChatChannelSearchSortEnum sort)
设置排序条件
void setEndTime(@Nullable Long endTime)
设置查询时间范围的结束时间
void setCursor(String cursor)
设置查询游标,下次查询的起始位置,第一页设置为null,查询下一页是传入上一页返回的cursor ...
QChatSearchChannelByPageParam(@NonNull String keyword, boolean asc, @Nullable Long startTime, @Nullable Long endTime, @Nullable Integer limit, @Nullable Long serverId, QChatChannelSearchSortEnum sort, @Nullable String cursor)
构造函数
QChatSearchChannelByPageParam(@NonNull String keyword, boolean asc, @Nullable Long startTime, @Nullable Long endTime, @Nullable Integer limit, @Nullable Long serverId)
构造函数