org.apache.cayenne.validation

## Class SimpleValidationFailure

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

- All Implemented Interfaces:
    Serializable, ValidationFailure
  Direct Known Subclasses:
    BeanValidationFailure

      public class SimpleValidationFailure
      extends Object
      implements ValidationFailure

  Represents a generic validation failure that contains failed object and a message describing the failure.
  Since:
    1.1
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Object` | `error`
    `protected Object` | `source`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SimpleValidationFailure(Object source, Object error)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getDescription()` Returns the error converted to String.
    `Object` | `getError()` Returns an user defined error object.
    `Object` | `getSource()` Returns object that failed the validation.
    `String` | `toString()` Returns a String representation of the failure.

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

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

- - ### Field Detail

    - #### source

          protected Object source

    - #### error

          protected Object error

  - ### Constructor Detail

    - #### SimpleValidationFailure

          public SimpleValidationFailure(Object source,
                                         Object error)

  - ### Method Detail

    - #### getDescription

          public String getDescription()

      Returns the error converted to String.
      Specified by:
        `getDescription` in interface `ValidationFailure`

    - #### getSource

          public Object getSource()

      Returns object that failed the validation.
      Specified by:
        `getSource` in interface `ValidationFailure`
      Returns:
        the failure's source or null in case a source cannot be defined.

    - #### getError

          public Object getError()

      Description copied from interface: `ValidationFailure`
      Returns an user defined error object.
      Specified by:
        `getError` in interface `ValidationFailure`

    - #### toString

          public String toString()

      Returns a String representation of the failure.
      Overrides:
        `toString` in class `Object`

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