Interface ValidationReport
- All Known Implementing Classes:
EmptyValidationReport,ImmutableValidationReport,MergedValidationReport
public interface ValidationReport
A report of validation errors that occurred during validation.
A report consists of a collection of messages with a given level.
Any message with a level of ValidationReport.Level.ERROR indicates a validation failure.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumThe validation levelstatic interfaceA single message in the validation reportstatic interfaceContextual information about a validation message. -
Method Summary
Modifier and TypeMethodDescriptionstatic ValidationReportempty()Return an empty report.static ValidationReportfrom(ValidationReport.Message... messages) Return an unmodifiable report containing all the provided messagesstatic ValidationReportfrom(Collection<ValidationReport.Message> messages) Return an unmodifiable report containing all the provided messagesGet the validation messages on this report.default booleanReturn if this validation report contains errors.default ValidationReportmerge(ValidationReport other) Merges the given validation report with this one, and return a new, unmodifiable report containing the messages from both reports.static ValidationReportsingleton(ValidationReport.Message message) Return an unmodifiable report that contains a single message.default Set<ValidationReport.Level>Return sorted set of levels found during validationApply the given additional message context to each message in this validation report, returning a new unmodifiable report.
-
Method Details
-
empty
Return an empty report.- Returns:
- an immutable empty report
-
singleton
Return an unmodifiable report that contains a single message.- Parameters:
message- The message to add to the report- Returns:
- An unmodifiable validation report with a single message
-
from
Return an unmodifiable report containing all the provided messages- Parameters:
messages- The messages to add to the report- Returns:
- an unmodifiable report containing all the provided messages
-
from
Return an unmodifiable report containing all the provided messages- Parameters:
messages- The messages to add to the report- Returns:
- an unmodifiable report containing all the provided messages
-
hasErrors
default boolean hasErrors()Return if this validation report contains errors.- Returns:
trueif a validation error exists;falseotherwise.
-
sortedValidationLevels
Return sorted set of levels found during validation- Returns:
- sorted set of levels, e.g. [ERROR, IGNORE]
-
getMessages
Get the validation messages on this report.- Returns:
- The messages recorded on this report
-
merge
Merges the given validation report with this one, and return a new, unmodifiable report containing the messages from both reports.- Parameters:
other- The validation report to merge with this one- Returns:
- A new, unmodifiable validation report containing all the messages from this report and the other report
-
withAdditionalContext
Apply the given additional message context to each message in this validation report, returning a new unmodifiable report.- Parameters:
context- The additional context to apply to each message in the report- Returns:
- A new, unmodifiable validation report containing all of the messages from this report, enhanced with the additional supplied context
-