Class ValidationException

  • All Implemented Interfaces:
    java.io.Serializable

    public class ValidationException
    extends RecoverableException
    Validation exception class. This is used for marshalling and unmarshalling errors that relate to data content.
    Version:
    1.0
    Author:
    Dennis M. Sosnoski
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      ValidationException​(java.lang.String msg)
      Constructor from message.
      ValidationException​(java.lang.String msg, java.lang.Object obj)
      Constructor from message and validation object.
      ValidationException​(java.lang.String msg, java.lang.Object obj, IUnmarshallingContext ctx)
      Constructor from message, validation object, and unmarshalling context.
      ValidationException​(java.lang.String msg, java.lang.Throwable root)
      Constructor from message and wrapped exception.
      ValidationException​(java.lang.String msg, java.lang.Throwable root, java.lang.Object obj)
      Constructor from message, wrapped exception, and validation object.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String addDescription​(java.lang.String msg, java.lang.Object obj)
      Add description information for a validation object to message.
      static java.lang.String describe​(java.lang.Object obj)
      Get description information for a validation object.
      java.lang.String getMessage()
      Get exception description.
      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getLocalizedMessage, getStackTrace, getSuppressed, initCause, setStackTrace, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ValidationException

        public ValidationException​(java.lang.String msg)
        Constructor from message.
        Parameters:
        msg - message describing the exception condition
      • ValidationException

        public ValidationException​(java.lang.String msg,
                                   java.lang.Throwable root)
        Constructor from message and wrapped exception.
        Parameters:
        msg - message describing the exception condition
        root - exception which caused this exception
      • ValidationException

        public ValidationException​(java.lang.String msg,
                                   java.lang.Object obj)
        Constructor from message and validation object.
        Parameters:
        msg - message describing the exception condition
        obj - source object for validation error
      • ValidationException

        public ValidationException​(java.lang.String msg,
                                   java.lang.Throwable root,
                                   java.lang.Object obj)
        Constructor from message, wrapped exception, and validation object.
        Parameters:
        msg - message describing the exception condition
        root - exception which caused this exception
        obj - source object for validation error
      • ValidationException

        public ValidationException​(java.lang.String msg,
                                   java.lang.Object obj,
                                   IUnmarshallingContext ctx)
        Constructor from message, validation object, and unmarshalling context.
        Parameters:
        msg - message describing the exception condition
        obj - source object for validation error
        ctx - context used for unmarshalling
    • Method Detail

      • describe

        public static java.lang.String describe​(java.lang.Object obj)
        Get description information for a validation object. For an unmarshalled object with source references available this returns the source position description. Otherwise, it returns the result of a Object.toString() method call.
        Parameters:
        obj - source object for validation error
        Returns:
        object description text
      • addDescription

        public static java.lang.String addDescription​(java.lang.String msg,
                                                      java.lang.Object obj)
        Add description information for a validation object to message. This just appends the result of a describe(java.lang.Object) call to the supplied message, with some appropriate formatting.
        Parameters:
        msg - base message text
        obj - source object for validation error
        Returns:
        message with object description appended
      • getMessage

        public java.lang.String getMessage()
        Get exception description.
        Overrides:
        getMessage in class java.lang.Throwable
        Returns:
        message describing the exception condition