org.iscreen
Class ValidationException

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

public class ValidationException
extends java.lang.Exception

When a validation failure occurs, eventually a ValidationException is thrown to the caller. This is a checked 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  java.util.List warnings
           
 
Constructor Summary
ValidationException()
          Default constructor with no pre-defined validation failures.
ValidationException(java.util.List validationFailures)
          Constructor with pre-defined validation failures.
ValidationException(java.util.List validationFailures, java.util.List validationWarnings)
          Constructor with pre-defined validation failures and warnings.
 
Method Summary
 void addFailure(ValidationFailure failure)
          Add a failure to this exception.
 void addWarning(ValidationFailure warning)
          Add a warning 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 getWarningMessages()
          Retrieves the list of warning messages (List of String objects).
 java.util.List getWarnings()
          Retrieves the List of ValidationFailures associated with this exception that represent the warnings.
 
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

warnings

protected java.util.List warnings
Constructor Detail

ValidationException

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


ValidationException

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

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

ValidationException

public ValidationException(java.util.List validationFailures,
                           java.util.List validationWarnings)
Constructor with pre-defined validation failures and warnings. Each List must contain ValidationFailure objects.

Parameters:
validationFailures - The List of failures for this exception.
validationWarnings - The List of warnings 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.

addWarning

public void addWarning(ValidationFailure warning)
Add a warning to this exception. This warning will be appended to the end of the internal list of warnings.

Parameters:
warning - The warning 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.

getWarnings

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

Returns:
Returns a List of warnings.

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).

getWarningMessages

public java.util.List getWarningMessages()
Retrieves the list of warning messages (List of String objects).

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