org.iscreen
Class ObjectValidationException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by org.iscreen.ObjectValidationException
All Implemented Interfaces:
java.io.Serializable

public class ObjectValidationException
extends java.lang.RuntimeException

When a validation failure occurs, eventually an ObjectValidationException is thrown to the caller. This is an unchecked exception that should be handled by the caller. The exception contains the list of ValidationFailures that represent the validations that have failed. Ultimately, the failures should be used to notify the end user (or system).

Author:
Shellman, Dan
See Also:
Serialized Form

Field Summary
protected  java.util.List failures
           
protected  ValidationException validationException
           
 
Constructor Summary
ObjectValidationException()
          Default constructor with no pre-defined validation failures.
ObjectValidationException(java.util.List validationFailures)
          Constructor with pre-defined validation failures.
ObjectValidationException(ValidationException e)
          Constructed from an existing ValidationException.
 
Method Summary
 void addFailure(ValidationFailure failure)
          Add a failure to this exception.
 java.util.List getFailureMessages()
          Retrieves the list of failure messages (List of String objects).
 java.util.List getFailures()
          Retrieves the List of ValidationFailures associated with this exception that represent the failures.
 java.util.List getFailures(int minimumSeverity)
          Retrieves the failures that meet the minimum severity level passed in.
 ValidationException getRootException()
          Provides access to the root ValidationException that was used to construct this exception.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

failures

protected java.util.List failures

validationException

protected ValidationException validationException
Constructor Detail

ObjectValidationException

public ObjectValidationException()
Default constructor with no pre-defined validation failures.


ObjectValidationException

public ObjectValidationException(ValidationException e)
Constructed from an existing ValidationException.

Parameters:
e - An existing ValidationException.

ObjectValidationException

public ObjectValidationException(java.util.List validationFailures)
Constructor with pre-defined validation failures.

Parameters:
validationFailures - The List of ValidationFailures for this exception.
Method Detail

addFailure

public void addFailure(ValidationFailure failure)
Add a failure to this exception. This failure will be appended to the end of the internal list of failures.

Parameters:
failure - The ValidationFailure to add to this exception.

getFailures

public java.util.List getFailures()
Retrieves the List of ValidationFailures associated with this exception that represent the failures.

Returns:
Returns a List of ValidationFailures.

getFailures

public java.util.List getFailures(int minimumSeverity)
Retrieves the failures that meet the minimum severity level passed in. This method is used to retrieve, for example, any warnings: getFailures( ValidationFailure.WARNING );

Parameters:
minimumSeverity - The minimal severity level.
Returns:
Returns a list of Validation Failure objects whose severity level is equal to or greater than minimumSeverity.

getFailureMessages

public java.util.List getFailureMessages()
Retrieves the list of failure messages (List of String objects).

Returns:
Returns the List of failure messages (as Strings).

getRootException

public ValidationException getRootException()
Provides access to the root ValidationException that was used to construct this exception. This is interesting in order to get access to the appropriate stack trace information.

Returns:
Returns the root ValidationException that generated this exception.