Package de.aristaflow.adept2.model.mail
Class EmailResult
- java.lang.Object
-
- de.aristaflow.adept2.model.mail.EmailResult
-
- All Implemented Interfaces:
Serializable
public class EmailResult extends Object implements Serializable
Simple object that wraps the result of sending an e-mail. If sending was successful,getMail()
will return the e-mail that was sent to the SMTP server. IfgetMail()
isnull
,getThrowable()
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description EmailResult(Email email)
Creates anEmailResult
for a successfully sent e-mail message.EmailResult(Email email, byte[] rawEmail, Throwable throwable, Boolean retryPossible)
Creates a newEmailResult
with the designated properties.EmailResult(Email email, Throwable throwable, Boolean retryPossible)
EmailResult(Throwable throwable, Boolean retryPossible)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
asynchronousRetry()
Email
getMail()
byte[]
getRawEmail()
Throwable
getThrowable()
boolean
isRetryPossible()
boolean
successful()
-
-
-
Constructor Detail
-
EmailResult
public EmailResult(Email email)
Creates anEmailResult
for a successfully sent e-mail message.- Parameters:
email
- The e-mail message that was successfully sent. This can benull
to indicate an asynchronous retry to send the mail.
-
EmailResult
public EmailResult(Throwable throwable, Boolean retryPossible)
- Parameters:
throwable
- The reason, why sending the e-mail message failed ornull
if no problems occurred.retryPossible
- Whether a later retry would make sense.null
will be interpreted asfalse
.
-
EmailResult
public EmailResult(Email email, Throwable throwable, Boolean retryPossible)
- Parameters:
email
- The e-mail message that has been sent ornull
if a problem occurred.throwable
- The reason, why sending the e-mail message failed ornull
if no problems occurred.retryPossible
- Whether a later retry would make sense.null
will be interpreted asfalse
.
-
EmailResult
public EmailResult(Email email, byte[] rawEmail, Throwable throwable, Boolean retryPossible)
Creates a newEmailResult
with the designated properties.- Parameters:
email
- The e-mail asEmail
ornull
. If this is notnull
butemail
isnull
, it will be converted appropriately so that both mail fields are set.rawEmail
- The rawEmail that was sent in byte[].throwable
- The reason, why sending the e-mail message failed ornull
if no problem occurred.retryPossible
- Whether a later retry would make sense.null
will be interpreted asfalse
.
-
-
Method Detail
-
successful
public boolean successful()
- Returns:
- Whether sending the e-mail was successful.
-
asynchronousRetry
public boolean asynchronousRetry()
- Returns:
- Whether an asynchronous retry is pending. In this case neither the e-mail nor the exception will be set.
-
getMail
public Email getMail()
- Returns:
- The e-mail message that was sent. If a problem occurred,
null
will be returned.
-
getThrowable
public Throwable getThrowable()
- Returns:
- The reason, why sending the e-mail message failed. If no problems occurred,
null
will be returned.
-
isRetryPossible
public boolean isRetryPossible()
- Returns:
- Whether a later retry would make sense.
-
getRawEmail
public byte[] getRawEmail()
- Returns:
- The e-mail message that was sent in byte[].
-
-