Interface ValidationResult

  • All Known Implementing Classes:
    DefaultValidationResult

    public interface ValidationResult

    An interface that defines the results of a validation process.

    Instances of this class are returned by Validator objects. They contain all information about the validation results: a flag whether the validation was successful and a list with messages generating during the validation operation. Messages can be either error or warning messages.

    Version:
    $Id: ValidationResult.java 205 2012-01-29 18:29:57Z oheger $
    Author:
    Oliver Heger
    • Method Detail

      • isValid

        boolean isValid()
        Returns a flag if the validation was successful. If this method returns true, the checked object can be considered valid.
        Returns:
        a flag if the validation was successful
      • getValidationMessages

        Collection<ValidationMessage> getValidationMessages()
        Returns a collection with all ValidationMessage objects that were created during validation. If isValid() returns false, this collection should at least contain one element with the ValidationMessageLevel ERROR. The objects in the returned collection can be used to find out, which specific errors have been occurred and for displaying messages to the user. The returned list must not be null.
        Returns:
        a list with validation messages
      • hasMessages

        boolean hasMessages​(ValidationMessageLevel level)
        Returns a flag whether this object contains validation messages of the specified level. This is convenient to find out whether there are errors or warnings without having to actually retrieve the messages.
        Parameters:
        level - the ValidationMessageLevel to check
        Returns:
        a flag whether there are messages of this ValidationMessageLevel
      • getValidationMessages

        Collection<ValidationMessage> getValidationMessages​(ValidationMessageLevel level)
        Returns a collection with all ValidationMessage objects of the specified level that were created during validation. This method allows filtering for a specific message level. An implementation should never return null.
        Parameters:
        level - the ValidationMessageLevel
        Returns:
        a collection with the available messages of this level