Record Class SendResult
java.lang.Object
java.lang.Record
cloud.opencode.base.email.SendResult
Email Send Result
邮件发送结果
Result of sending an email, containing the message ID for tracking.
发送邮件的结果,包含用于跟踪的消息ID。
Features | 主要功能:
- Message ID for tracking - 用于跟踪的消息ID
- Send timestamp - 发送时间戳
- Success status - 成功状态
Usage Examples | 使用示例:
SendResult result = OpenEmail.sendWithResult(email);
System.out.println("Message ID: " + result.messageId());
System.out.println("Sent at: " + result.sentAt());
Security | 安全性:
- Thread-safe: Yes (immutable record) - 线程安全: 是(不可变记录)
- Since:
- JDK 25, opencode-base-email V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionSendResult(String messageId, Instant sentAt, boolean success) Creates an instance of aSendResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.static SendResultfailure()Create a failed send result 创建失败的发送结果final inthashCode()Returns a hash code value for this object.booleanCheck if the message has a message ID 检查消息是否有消息IDReturns the value of themessageIdrecord component.sentAt()Returns the value of thesentAtrecord component.booleansuccess()Returns the value of thesuccessrecord component.static SendResultCreate a successful send result 创建成功的发送结果final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
SendResult
-
-
Method Details
-
success
Create a successful send result 创建成功的发送结果- Parameters:
messageId- the message ID | 消息ID- Returns:
- the send result | 发送结果
-
failure
Create a failed send result 创建失败的发送结果- Returns:
- the send result | 发送结果
-
hasMessageId
public boolean hasMessageId()Check if the message has a message ID 检查消息是否有消息ID- Returns:
- true if message ID is present | 存在消息ID返回true
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
messageId
Returns the value of themessageIdrecord component.- Returns:
- the value of the
messageIdrecord component
-
sentAt
Returns the value of thesentAtrecord component.- Returns:
- the value of the
sentAtrecord component
-
success
public boolean success()Returns the value of thesuccessrecord component.- Returns:
- the value of the
successrecord component
-