org.apache.cayenne.validation

## Class ValidationResult

- java.lang.Object
- - org.apache.cayenne.validation.ValidationResult

- All Implemented Interfaces:
    Serializable

      public class ValidationResult
      extends Object
      implements Serializable

  Represents a result of a validation execution. Contains a set of `ValidationFailures`that occured in a given context. All failures are kept in the same order they were added.
  Since:
    1.1
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ValidationResult()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addFailure(ValidationFailure failure)` Add a failure to the validation result.
    `void` | `clear()`
    `List<ValidationFailure>` | `getFailures()` Returns all failures added to this result, or empty list is result has no failures.
    `List<ValidationFailure>` | `getFailures(Object source)` Returns all failures related to the `source` object, or an empty list if there are no such failures.
    `boolean` | `hasFailures()` Returns true if at least one failure has been added to this result.
    `boolean` | `hasFailures(Object source)`
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### ValidationResult

          public ValidationResult()

  - ### Method Detail

    - #### addFailure

          public void addFailure(ValidationFailure failure)

      Add a failure to the validation result.
      Parameters:
        `failure` - failure to be added. It may not be null.
      See Also:
        `ValidationFailure`

    - #### getFailures

          public List<ValidationFailure> getFailures()

      Returns all failures added to this result, or empty list is result has no failures.

    - #### getFailures

          public List<ValidationFailure> getFailures(Object source)

      Returns all failures related to the `source` object, or an empty list if there are no such failures.
      Parameters:
        `source` - it may be null.
      See Also:
        `ValidationFailure.getSource()`

    - #### hasFailures

          public boolean hasFailures()

      Returns true if at least one failure has been added to this result. False otherwise.

    - #### hasFailures

          public boolean hasFailures(Object source)

      Parameters:
        `source` - it may be null.
      Returns:
        true if there is at least one failure for `source`. False otherwise.

    - #### clear

          public void clear()

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2001–2021 Apache Cayenne. All rights reserved.