public class ErrorAttachableImpl extends java.lang.Object implements ErrorAttachable
ErrorAttachable
that implements ErrorAttachable.attach(java.lang.String...) methods but
not ErrorAttachable.reportAttachedErrors(). The
error reports are delegated to the sub-class that extends
to this class.
Use the method getErrorMessages()
to get an immutable copy of all the attached messages.
| Constructor and Description |
|---|
ErrorAttachableImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
applySnapshot(java.util.List<java.lang.String> errorMessages)
Applies a snapshot, memento design pattern
|
void |
attach(java.lang.String... messages)
Adds all the
messages to the list of error messages |
void |
attach(java.lang.String header,
java.lang.Throwable error)
Attaches the specified error using the specified
reason/title/header.
|
void |
attachAll(ErrorAttachable attachable)
Attaches all the error messages of the specified
attachable
into this ErrorAttachable |
int |
errorCount()
Returns the current error count
|
java.lang.String |
formatMessages()
Formats the error messages in this error-attachable
|
java.util.List<java.lang.String> |
getErrorMessages()
Gets an immutable copy of all the attached
error messages.
|
boolean |
hasErrors() |
void |
reportAttachedErrors()
By default the errors cannot be reported
|
public void attach(java.lang.String... messages)
messages to the list of error messagesattach in interface ErrorAttachablemessages - The reported error messagespublic void attach(java.lang.String header,
java.lang.Throwable error)
ErrorAttachableattach in interface ErrorAttachableheader - The error headererror - The errorpublic void attachAll(ErrorAttachable attachable)
attachable
into this ErrorAttachableattachAll in interface ErrorAttachableattachable - The error attachablepublic boolean hasErrors()
hasErrors in interface ErrorAttachablepublic java.util.List<java.lang.String> getErrorMessages()
getErrorMessages in interface ErrorAttachablepublic void applySnapshot(java.util.List<java.lang.String> errorMessages)
ErrorAttachableapplySnapshot in interface ErrorAttachableerrorMessages - The error messagespublic java.lang.String formatMessages()
formatMessages in interface ErrorAttachablepublic int errorCount()
ErrorAttachableerrorCount in interface ErrorAttachablepublic void reportAttachedErrors()
reportAttachedErrors in interface ErrorAttachable