jigcell.compare.impl
Class ExceptionRecorder

java.lang.Object
  extended by jigcell.compare.impl.ExceptionRecorder
All Implemented Interfaces:
java.beans.ExceptionListener

public final class ExceptionRecorder
extends java.lang.Object
implements java.beans.ExceptionListener

Provides listening and reporting options for asynchronous exception handling.

This code is licensed under the DARPA BioCOMP Open Source License. See LICENSE for more details.

Author:
Nicholas Allen

Field Summary
private static int CHECK
          Flag to cause a checked assertion
private  Compare compare
          Comparator
private  java.lang.Exception exception
          The most recent exception we've caught
private  int flags
          How to handle the received exception
private static int LOG
          Flag to log the exception
private static java.lang.String MESSAGE_EXCEPTIONCAUGHT
          Error message when an exception is caught
private static int REPORT
          Flag to report the exception to the user
private  java.lang.String reportMessage
          Message to use when reporting an exception
private static int SAVE
          Flag to save the exception
 
Constructor Summary
ExceptionRecorder(Compare compare, java.lang.String reportMessage, boolean save)
          Creates a new asynchronous exception handler that reports using the shell handler.
ExceptionRecorder(java.lang.String reportMessage, boolean check, boolean log, boolean save)
          Creates a new asynchronous exception handler.
 
Method Summary
 void clear()
          Clears any exceptions caught by this handler.
 void exceptionThrown(java.lang.Exception e)
           
 java.lang.Exception getLastException()
          The last exception caught by this handler.
 boolean hasException()
          Whether this handler has caught an exception.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHECK

private static final int CHECK
Flag to cause a checked assertion

See Also:
Constant Field Values

LOG

private static final int LOG
Flag to log the exception

See Also:
Constant Field Values

REPORT

private static final int REPORT
Flag to report the exception to the user

See Also:
Constant Field Values

SAVE

private static final int SAVE
Flag to save the exception

See Also:
Constant Field Values

MESSAGE_EXCEPTIONCAUGHT

private static final java.lang.String MESSAGE_EXCEPTIONCAUGHT
Error message when an exception is caught

See Also:
Constant Field Values

flags

private final int flags
How to handle the received exception


compare

private final Compare compare
Comparator


exception

private java.lang.Exception exception
The most recent exception we've caught


reportMessage

private final java.lang.String reportMessage
Message to use when reporting an exception

Constructor Detail

ExceptionRecorder

public ExceptionRecorder(Compare compare,
                         java.lang.String reportMessage,
                         boolean save)
Creates a new asynchronous exception handler that reports using the shell handler.

Parameters:
compare - Comparator required for using the shell handler
reportMessage - Message to use when reporting an exception
save - Save the most recently caught exception

ExceptionRecorder

public ExceptionRecorder(java.lang.String reportMessage,
                         boolean check,
                         boolean log,
                         boolean save)
Creates a new asynchronous exception handler.

Parameters:
check - Report the exception using the Comparator assertion handler. There will also be a log message.
log - Report the exception using the Comparator log handler
save - Save the most recently caught exception
Method Detail

clear

public void clear()
Clears any exceptions caught by this handler.


exceptionThrown

public void exceptionThrown(java.lang.Exception e)
Specified by:
exceptionThrown in interface java.beans.ExceptionListener

getLastException

public java.lang.Exception getLastException()
The last exception caught by this handler. Reading the exception will clear it.


hasException

public boolean hasException()
Whether this handler has caught an exception. The exception is unaffected by this method.