这是我的初始设置String json = "{'text': 'what is my balance', 'mid': 'D1dexnEBTCefEdRWveEt8A', 'seq': 73}";import java.io.Serializable;import java.time.LocalDateTime;import org.apache.commons.lang3.builder.EqualsBuilder;import com.fasterxml.jackson.annotation.JsonProperty;import com.fasterxml.jackson.databind.annotation.JsonDeserialize;@JsonDeserialize(builder = Messages.MessageBuilder.class)public class Message implements Serializable { @JsonProperty("id") public final String id; @JsonProperty("botId") public final String botId; @JsonProperty("userId") public final String userId; public final String userIdKey; public boolean echoText=false; public String text; public String timeZone; public volatile String username; @JsonProperty("conversationId") public volatile String conversationId; public volatile int kaiUserId; public volatile String token; public final LocalDateTime inboundReceivedAt; public volatile LocalDateTime outboundSentAt; final String key; private final int _hashCode; public volatile long lastAccess = System.currentTimeMillis(); public Message(final String pMessageId, final String pUserId, final String pBotId, final String pConversationId, final String pText) { id = pMessageId; userId = pUserId; botId = pBotId; conversationId = pConversationId; text = pText; inboundReceivedAt = LocalDateTime.now(); key = id + "-" + userId + "-" + botId; userIdKey = userId + "~" + botId; _hashCode = key.hashCode(); } void touch() { lastAccess = System.currentTimeMillis(); } @Override public int hashCode() { return _hashCode; } @Override public boolean equals(final Object pObject) { if (!(pObject instanceof Message)) { return false; } return new EqualsBuilder().append(id, ((Message)pObject).id) .append(botId, ((Message)pObject).botId) .append(userId, ((Message)pObject).userId) .isEquals(); }
添加回答
举报
0/150
提交
取消