Package com.persequor.extension.common
Interface IValidationResult
public interface IValidationResult
Result of a validation. The method of registering results is left to each implementation.
Usage: Implement a subinterface of this
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
addAdditionalData
(String prefix, String key, String value) Adds additional data to the result.void
Adds a non-fatal error to the resultvoid
addFatalError
(String message) Adds a fatal error to the resultvoid
addWarning
(String warning) Adds a warning to the resultMethod to retrieve all registered errors as a collection of StringsMethod to retrieve all registered fatal errors as a collection of StringsMethod to retrieve all registered non-fatal errors as a collection of StringsMethod to retrieve all registered warnings as a collection of Stringsdefault boolean
boolean
boolean
boolean
-
Method Details
-
getErrors
Collection<String> getErrors()Method to retrieve all registered errors as a collection of Strings- Returns:
- list of all error messages
-
getNonFatalErrors
Collection<String> getNonFatalErrors()Method to retrieve all registered non-fatal errors as a collection of Strings- Returns:
- list of non-fatal error messages
-
getFatalErrors
Collection<String> getFatalErrors()Method to retrieve all registered fatal errors as a collection of Strings- Returns:
- list of fatal error messages
-
getWarnings
Collection<String> getWarnings()Method to retrieve all registered warnings as a collection of Strings- Returns:
- list of warning messages
-
addError
Adds a non-fatal error to the result- Parameters:
message
- description
-
addFatalError
Adds a fatal error to the result- Parameters:
message
- description
-
addWarning
Adds a warning to the result- Parameters:
warning
- description
-
addAdditionalData
Adds additional data to the result.Does not affect the outcome of the validation.
Extra helper methods for manipulating additional data is available on the
AdditionalData
object returned fromgetAdditionalData()
- Parameters:
prefix
- prefix of the datakey
- key of the datavalue
- value of the data
-
hasErrors
default boolean hasErrors()- Returns:
- whether there are any errors, fatal or non-fatal
-
hasNonFatalErrors
boolean hasNonFatalErrors()- Returns:
- whether there are any non-fatal errors
-
hasFatalErrors
boolean hasFatalErrors()- Returns:
- whether there are any fatal errors
-
hasWarnings
boolean hasWarnings()- Returns:
- whether there are any warnings
-
getAdditionalData
AdditionalData getAdditionalData()- Returns:
- any additional data that has been added to the result
-