Record Class BatchSendResult.ItemResult

java.lang.Object
java.lang.Record
cloud.opencode.base.email.BatchSendResult.ItemResult
Record Components:
email - the email that was sent | 被发送的邮件
messageId - the message ID (null if failed) | 消息ID(失败时为null)
success - whether the send succeeded | 是否发送成功
error - the error message (null if succeeded) | 错误消息(成功时为null)
cause - the exception cause (null if succeeded) | 异常原因(成功时为null)
Enclosing class:
BatchSendResult

public static record BatchSendResult.ItemResult(Email email, String messageId, boolean success, String error, Throwable cause) extends Record
Individual email send result within a batch 批量中单封邮件的发送结果
Since:
JDK 25, opencode-base-email V1.0.3
Author:
Leon Soo www.LeonSoo.com
  • Constructor Details

    • ItemResult

      public ItemResult(Email email, String messageId, boolean success, String error, Throwable cause)
      Creates an instance of a ItemResult record class.
      Parameters:
      email - the value for the email record component
      messageId - the value for the messageId record component
      success - the value for the success record component
      error - the value for the error record component
      cause - the value for the cause record component
  • Method Details

    • success

      public static BatchSendResult.ItemResult success(Email email, String messageId)
      Create a success result 创建成功结果
      Parameters:
      email - the email | 邮件
      messageId - the message ID | 消息ID
      Returns:
      the result | 结果
    • failure

      public static BatchSendResult.ItemResult failure(Email email, Throwable cause)
      Create a failure result 创建失败结果
      Parameters:
      email - the email | 邮件
      cause - the exception | 异常
      Returns:
      the result | 结果
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • email

      public Email email()
      Returns the value of the email record component.
      Returns:
      the value of the email record component
    • messageId

      public String messageId()
      Returns the value of the messageId record component.
      Returns:
      the value of the messageId record component
    • success

      public boolean success()
      Returns the value of the success record component.
      Returns:
      the value of the success record component
    • error

      public String error()
      Returns the value of the error record component.
      Returns:
      the value of the error record component
    • cause

      public Throwable cause()
      Returns the value of the cause record component.
      Returns:
      the value of the cause record component