public final class CompoundErrors
extends java.lang.Object
Initializable class. This enables implementing a validation logic that will not stop at the first error, and
return a message compounding multiple error messages.| Constructor and Description |
|---|
CompoundErrors() |
| Modifier and Type | Method and Description |
|---|---|
void |
addErrorMessage(java.lang.String error)
Add a new error message to the set of errors being returned from this validation
|
java.lang.String |
getErrorMessage()
Creates an error message comprised of all of the error messages added to this instance by calling
addErrorMessage(String). |
java.lang.String |
getErrorMessage(java.lang.String separator)
A specialized version of
getErrorMessage(), using a specific separator. |
boolean |
hasErrors() |
public void addErrorMessage(java.lang.String error)
error - message to add. If null the message will be ignoredpublic boolean hasErrors()
true if errors have been added to this instancepublic java.lang.String getErrorMessage()
addErrorMessage(String). If no error messages were added then null is returned.
This method uses a newline ('\n') character to separate the different error messages.
null if hasErrors() returns falsepublic java.lang.String getErrorMessage(java.lang.String separator)
getErrorMessage(), using a specific separator.separator - String separating individual error messages in the final string.null if hasErrors() returns false