1 package com.netease.nimlib.sdk.msg.model;
3 import androidx.annotation.NonNull;
4 import androidx.annotation.Nullable;
12 import java.io.Serializable;
22 private final String sessionId;
31 private long fromTime;
43 private long anchorServerId;
48 private String anchorClientId;
68 this(sessionId, sessionType, fromTime, toTime, anchorServerId, anchorClientId, limit, direction,
GetMessageModeEnum.
DEFAULT);
72 this.sessionId = sessionId;
73 this.sessionType = sessionType;
74 this.fromTime = fromTime;
76 this.anchorServerId = anchorServerId;
77 this.anchorClientId = anchorClientId;
79 this.direction = direction;
98 this.fromTime = fromTime;
106 this.toTime = toTime;
110 return anchorServerId;
114 this.anchorServerId = anchorServerId;
118 return anchorClientId;
122 this.anchorClientId = anchorClientId;
138 this.direction = direction;
155 if (StringUtil.isNotEmpty(clientId)) {
156 IMMessage anchor = MsgDBHelper.queryMessageByUuid(clientId);
157 if (anchor instanceof IMMessageImpl) {
169 String formedSessionId = this.sessionId;
171 long formedFromTime = this.fromTime;
172 long formedToTime = this.toTime;
173 long formedExcludeServerId = this.anchorServerId;
174 String formedExcludeClientId = this.anchorClientId;
175 int formedLimit = this.limit;
180 return new GetMessagesDynamicallyParam(formedSessionId, formedSessionType, formedFromTime, formedToTime, formedExcludeServerId, formedExcludeClientId, formedLimit, formedDirection, mode);
189 return StringUtil.isNotEmpty(sessionId)
193 && limit >= 0 && limit <= MAX_LIMIT
194 && (anchorServerId == 0 || StringUtil.isNotEmpty(anchorClientId));
199 return "GetMessagesDynamicallyParam{" +
200 "sessionId='" + sessionId +
'\'' +
201 ", sessionType=" + sessionType +
202 ", fromTime=" + fromTime +
203 ", toTime=" + toTime +
204 ", excludeServerId=" + anchorServerId +
205 ", excludeClientId='" + anchorClientId +
'\'' +
207 ", direction=" + direction +
void setAnchorServerId(long anchorServerId)
void setFromTime(long fromTime)
云信 IM 消息构造器,提供构建各类型消息的接口。
void setAnchorClientId(String anchorClientId)
String getAnchorClientId()
NIM消息实体数据结构。 第三方APP不要调用设置类接口,调用之后不会被持久化
GetMessageDirectionEnum getDirection()
static final int MAX_LIMIT
最大数量限制
static IMMessage createEmptyMessage(String sessionId, SessionTypeEnum sessionType, long time)
创建一条空消息。
boolean isValid()
参数合法的初阶判断函数
GetMessagesDynamicallyParam createStandardizedParam()
void setToTime(long toTime)
GetMessagesDynamicallyParam(@NonNull String sessionId,@NonNull SessionTypeEnum sessionType, long fromTime, long toTime, long anchorServerId, String anchorClientId, int limit,@Nullable GetMessageDirectionEnum direction)
GetMessagesDynamicallyParam(@NonNull String sessionId,@NonNull SessionTypeEnum sessionType)
void setMode(GetMessageModeEnum mode)
void setDirection(GetMessageDirectionEnum direction)
IMMessage getAnchor()
可能会查询数据库
GetMessageModeEnum getMode()
SessionTypeEnum getSessionType()