public class BreakEmailFetchException extends RuntimeException
In email client functions where isSatisfy lambda expression is used this exception can be thrown
for immediate interrupting of the function execution.
Here is an example of using this exception:
@Injectprivate EmailClient emailClient; public void execute() { ... log.info("Fetch the first message from default inbox folder that contain attachments.");List<EmailMessage>messages = emailClient.fetchMessages(msg -> { if (msg.hasAttachments()) { //By throwing this exception it stops further checking of //emails and return this message as single result throw new BreakEmailFetchException(true); } return false; }); ... }
EmailClient.fetchMessages(Predicate),
EmailClient.fetchMessages(String, Predicate),
EmailClient.fetchAllMessages(Predicate),
EmailClient.waitMessages(Predicate),
EmailClient.waitMessages(Predicate, Duration),
EmailClient.waitMessages(Predicate, Duration, Duration),
EmailClient.waitMessages(String, Predicate),
EmailClient.waitMessages(String, Predicate, Duration),
EmailClient.waitMessages(String, Predicate, Duration, Duration),
Serialized Form| Constructor and Description |
|---|
BreakEmailFetchException(boolean includeIntoResult)
Constructs a new BreakEmailFetchException.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
isIncludeIntoResult()
Checks whether is necessary to put the currently checking email message into results.
|
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringpublic BreakEmailFetchException(boolean includeIntoResult)
includeIntoResult - the flag that indicates whether is necessary to put the currently checking
email message into results. If the value is true then the currently
checking email message should be included into results.Copyright © 2023. All rights reserved.