com.goldenhammer.correctness
Class ExceptionMonitor

java.lang.Object
  extended bycom.goldenhammer.correctness.ExceptionMonitor

public class ExceptionMonitor
extends java.lang.Object

This is the ExceptionMonitor. It provides a single point of access for dealing with exceptions. The handling is delegated to an instance of an ExceptionHandler contained within. The handler utilizes the Strategy pattern so that the way in which it is handled can be changed dynamically.


Constructor Summary
ExceptionMonitor()
           
 
Method Summary
 void handle(java.lang.Exception e)
          Deals with the exception using the handler which this class was initialized with.
static ExceptionMonitor instance()
          Returns the instance of the exception monitor.
 void setExceptionHandler(ExceptionHandler handler)
          Changes the monitor's handler to the specified ExceptionHandler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExceptionMonitor

public ExceptionMonitor()
Method Detail

instance

public static ExceptionMonitor instance()
Returns the instance of the exception monitor.

Returns:
The instance of the exception monitor.

setExceptionHandler

public void setExceptionHandler(ExceptionHandler handler)
Changes the monitor's handler to the specified ExceptionHandler.

Parameters:
handler - The handler to use for this monitor.

handle

public void handle(java.lang.Exception e)
Deals with the exception using the handler which this class was initialized with.

Parameters:
e - The exception to handle.