NIMSDK-AOS  10.9.71
V2NIMThreadMessageListOption.java
浏览该文件的文档.
1 package com.netease.nimlib.sdk.v2.message.option;
2 
5 import com.netease.nimlib.v2.message.impl.V2NIMMessageReferImpl;
6 import java.io.Serializable;
7 
8 /**
9  * Thread消息列表查询参数
10  */
11 public class V2NIMThreadMessageListOption implements Serializable {
12 
13  /**
14  * 根消息引用
15  */
16  private V2NIMMessageRefer messageRefer;
17  /**
18  * 查询开始时间,闭区间,小于等于 endTime
19  * 默认从0开始查询
20  */
21  private long beginTime = 0L;
22  /**
23  * 查询结束时间,闭区间
24  * 默认当前时间+1个小时
25  */
26  private long endTime = 0L;
27  /**
28  * 锚点消息ServerId,根据锚点消息查询,不包含该消息
29  * 默认为"0"
30  */
31  private String excludeMessageServerId = null;
32  /**
33  * 每次查询条数,默认50,必须大于 0, 小于等于0报参数错误
34  */
35  private Integer limit = 50;
36  /**
37  * 消息查询方向,默认V2NIM_QUERY_DIRECTION_DESC
38  */
40 
41  /**
42  * 获取根消息引用
43  * @return 根消息引用
44  */
46  return messageRefer;
47  }
48  /**
49  * 设置根消息引用
50  * @param messageRefer 根消息引用
51  */
52  public void setMessageRefer(V2NIMMessageRefer messageRefer) {
53  this.messageRefer = messageRefer;
54  }
55 
56  /**
57  * 获取查询开始时间
58  * @return 查询开始时间
59  */
60  public long getBeginTime() {
61  return beginTime;
62  }
63 
64  /**
65  * 设置查询开始时间
66  * @param beginTime 查询开始时间
67  */
68  public void setBeginTime(long beginTime) {
69  this.beginTime = beginTime;
70  }
71  /**
72  * 获取查询结束时间
73  * @return 查询结束时间
74  */
75  public long getEndTime() {
76  return endTime;
77  }
78 
79  /**
80  * 设置查询结束时间
81  * @param endTime
82  */
83  public void setEndTime(long endTime) {
84  this.endTime = endTime;
85  }
86 
87  /**
88  * 获取锚点消息ServerId
89  * @return
90  */
91  public String getExcludeMessageServerId() {
92  return excludeMessageServerId;
93  }
94 
95  /**
96  * 设置锚点消息ServerId
97  * @param excludeMessageServerId
98  */
99  public void setExcludeMessageServerId(String excludeMessageServerId) {
100  this.excludeMessageServerId = excludeMessageServerId;
101  }
102 
103  /**
104  * 获取每次查询条数
105  * @return 每次查询条数
106  */
107  public Integer getLimit() {
108  return limit;
109  }
110 
111  /**
112  * 设置每次查询条数
113  * @param limit 每次查询条数
114  */
115  public void setLimit(Integer limit) {
116  this.limit = limit;
117  }
118 
119  /**
120  * 获取查询方向
121  * @return 查询方向
122  */
124  return direction;
125  }
126 
127  /**
128  * 设置查询方向
129  * @param direction 查询方向
130  */
131  public void setDirection(V2NIMQueryDirection direction) {
132  this.direction = direction;
133  }
134 
135  public boolean isValid() {
136  if(!V2NIMMessageReferImpl.isValid(messageRefer)) {
137  return false;
138  }
139  if(limit <= 0) {
140  return false;
141  }
142 
143  if(beginTime != 0L && endTime != 0L && beginTime > endTime) {
144  return false;
145  }
146  return true;
147  }
148 }
void setMessageRefer(V2NIMMessageRefer messageRefer)
设置根消息引用
void setExcludeMessageServerId(String excludeMessageServerId)
设置锚点消息ServerId