1 package com.netease.nimlib.sdk.v2.message.option;
3 import androidx.annotation.NonNull;
4 import androidx.annotation.Nullable;
8 import java.io.Serializable;
14 private final String conversationId;
17 private final List<V2NIMMessageType> messageTypes;
20 private final long beginTime;
23 private final long endTime;
27 private final int limit;
40 private final boolean strictMode;
43 private final boolean onlyQueryLocal;
46 this(
"", null, DEFAULT_BEGIN_TIME, DEFAULT_END_TIME, DEFAULT_LIMIT, null, DEFAULT_DIRECTION,
false,
false);
50 this.conversationId = conversationId;
51 this.messageTypes = messageTypes;
52 this.beginTime = beginTime;
53 this.endTime = endTime;
55 this.anchorMessage = anchorMessage;
56 this.direction = direction == null ? DEFAULT_DIRECTION : direction;
57 this.strictMode = strictMode;
58 this.onlyQueryLocal = onlyQueryLocal;
62 return conversationId;
86 if (direction == null) {
87 return DEFAULT_DIRECTION;
98 return onlyQueryLocal;
101 private static final long DEFAULT_BEGIN_TIME = 0;
102 private static final long DEFAULT_END_TIME = 0;
103 private static final int DEFAULT_LIMIT = 50;
106 public static final class V2NIMMessageListOptionBuilder {
107 private final String conversationId;
108 private List<V2NIMMessageType> messageTypes;
109 private long beginTime = DEFAULT_BEGIN_TIME;
110 private long endTime = DEFAULT_END_TIME;
111 private int limit = DEFAULT_LIMIT;
114 private boolean strictMode;
115 private boolean onlyQueryLocal;
117 private V2NIMMessageListOptionBuilder(
final String conversationId) {
118 this.conversationId = conversationId;
121 public static V2NIMMessageListOptionBuilder builder(
final String conversationId) {
122 return new V2NIMMessageListOptionBuilder(conversationId);
125 public V2NIMMessageListOptionBuilder withMessageTypes(List<V2NIMMessageType> messageTypes) {
126 this.messageTypes = messageTypes;
130 public V2NIMMessageListOptionBuilder withBeginTime(
long beginTime) {
131 this.beginTime = beginTime;
135 public V2NIMMessageListOptionBuilder withEndTime(
long endTime) {
136 this.endTime = endTime;
140 public V2NIMMessageListOptionBuilder withLimit(
int limit) {
145 public V2NIMMessageListOptionBuilder withAnchorMessage(
V2NIMMessage anchorMessage) {
146 this.anchorMessage = anchorMessage;
151 this.direction = direction;
155 public V2NIMMessageListOptionBuilder withStrictMode(
boolean strictMode) {
156 this.strictMode = strictMode;
160 public V2NIMMessageListOptionBuilder withOnlyQueryLocal(
boolean onlyQueryLocal) {
161 this.onlyQueryLocal = onlyQueryLocal;
166 return new V2NIMMessageListOption(conversationId, messageTypes, beginTime, endTime, limit, anchorMessage, direction, strictMode, onlyQueryLocal);
V2NIMMessage getAnchorMessage()
String getConversationId()
V2NIM_QUERY_DIRECTION_DESC
List< V2NIMMessageType > getMessageTypes()
boolean isOnlyQueryLocal()
V2NIMMessageQueryDirection getDirection()