things.common
Class ThingsExceptionBundle<E extends ThingsException>

java.lang.Object
  extended by things.common.ThingsExceptionBundle<E>

public class ThingsExceptionBundle<E extends ThingsException>
extends java.lang.Object

Creates a bundle of exceptions and methods for accessing them. You can use this to collect errors without interrupting processing.

Version:
1.0

Version History

EPG - Initial - 22 MAY 05
 
Author:
Erich P. Gatejen

Constructor Summary
ThingsExceptionBundle()
          Default Constructor.
 
Method Summary
 void add(E exp)
          Add an exception.
 E resolve()
          Resolve to single exception.
 int size()
          Get the number of exceptions in the bundle.
 void throwResolved()
          Resolve to single exception and throws it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThingsExceptionBundle

public ThingsExceptionBundle()
Default Constructor.

Method Detail

add

public void add(E exp)
Add an exception.

Parameters:
exp - The exception to add.

resolve

public E resolve()
Resolve to single exception. If there are no exceptions in the list, it'll return a null. If there is only one in the list, it will return the one. If there are more than one, it will return the worse exception (numerically) with the other exceptions as attributes. Generally, the attributes will be made unique so none are lost.

Returns:
The single exception or null if there are none.

throwResolved

public void throwResolved()
                   throws E extends ThingsException
Resolve to single exception and throws it. See resolve() for the method. If there is no exception in the bundle, it quietly returns.

Throws:
E - the resolved exception.
E extends ThingsException

size

public int size()
Get the number of exceptions in the bundle.

Returns:
the number (or zero if there are none).


Things.