Record Class BatchSendResult
java.lang.Object
java.lang.Record
cloud.opencode.base.email.BatchSendResult
public record BatchSendResult(List<BatchSendResult.ItemResult> results, Instant startedAt, Duration duration)
extends Record
Batch Email Send Result
批量邮件发送结果
Contains the results of a batch email send operation, including individual results for each email.
包含批量邮件发送操作的结果,包括每封邮件的单独结果。
Features | 主要功能:
- Individual results per email - 每封邮件的单独结果
- Success/failure counts - 成功/失败计数
- Total duration tracking - 总耗时跟踪
Usage Examples | 使用示例:
BatchSendResult result = sender.sendBatch(emails);
System.out.println("Sent: " + result.successCount() + "/" + result.totalCount());
result.failures().forEach(f -> log.error("Failed: {}", f.error()));
Security | 安全性:
- Thread-safe: Yes (immutable record) - 线程安全: 是(不可变记录)
- Since:
- JDK 25, opencode-base-email V1.0.3
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordIndividual email send result within a batch 批量中单封邮件的发送结果 -
Constructor Summary
ConstructorsConstructorDescriptionBatchSendResult(List<BatchSendResult.ItemResult> results, Instant startedAt, Duration duration) Creates an instance of aBatchSendResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanCheck if all emails were sent successfully 检查是否所有邮件都已成功发送duration()Returns the value of thedurationrecord component.final booleanIndicates whether some other object is "equal to" this one.intGet the number of failed emails 获取发送失败的邮件数量failures()Get only the failed results 仅获取失败的结果final inthashCode()Returns a hash code value for this object.results()Returns the value of theresultsrecord component.Returns the value of thestartedAtrecord component.intGet the number of successfully sent emails 获取成功发送的邮件数量Get only the successful results 仅获取成功的结果final StringtoString()Returns a string representation of this record class.intGet the total number of emails in the batch 获取批量中的邮件总数
-
Constructor Details
-
BatchSendResult
public BatchSendResult(List<BatchSendResult.ItemResult> results, Instant startedAt, Duration duration) Creates an instance of aBatchSendResultrecord class.- Parameters:
results- the value for theresultsrecord componentstartedAt- the value for thestartedAtrecord componentduration- the value for thedurationrecord component
-
-
Method Details
-
totalCount
public int totalCount()Get the total number of emails in the batch 获取批量中的邮件总数- Returns:
- the total count | 总数
-
successCount
public int successCount()Get the number of successfully sent emails 获取成功发送的邮件数量- Returns:
- the success count | 成功数量
-
failureCount
public int failureCount()Get the number of failed emails 获取发送失败的邮件数量- Returns:
- the failure count | 失败数量
-
allSucceeded
public boolean allSucceeded()Check if all emails were sent successfully 检查是否所有邮件都已成功发送- Returns:
- true if all succeeded | 全部成功返回true
-
failures
Get only the failed results 仅获取失败的结果- Returns:
- list of failed results | 失败结果列表
-
successes
Get only the successful results 仅获取成功的结果- Returns:
- list of successful results | 成功结果列表
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
results
Returns the value of theresultsrecord component.- Returns:
- the value of the
resultsrecord component
-
startedAt
Returns the value of thestartedAtrecord component.- Returns:
- the value of the
startedAtrecord component
-
duration
Returns the value of thedurationrecord component.- Returns:
- the value of the
durationrecord component
-