de.unkrig.commons.file
Class ExceptionHandler<E extends java.lang.Exception>

java.lang.Object
  extended by de.unkrig.commons.file.ExceptionHandler<E>
Type Parameters:
E - The exception type that is handled

public abstract class ExceptionHandler<E extends java.lang.Exception>
extends java.lang.Object

A helper class that is useful when exceptions should not be caught, but handled.


Constructor Summary
ExceptionHandler()
           
 
Method Summary
static
<E extends java.lang.Exception>
ExceptionHandler<E>
defaultHandler()
           
abstract  void handle(E exception)
          Handles the given exception, e.g. by printing, logging or rethrowing it.
abstract  void handle(java.lang.RuntimeException runtimeException)
          Handles the given runtimeException, e.g. by printing, logging or rethrowing it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExceptionHandler

public ExceptionHandler()
Method Detail

defaultHandler

public static <E extends java.lang.Exception> ExceptionHandler<E> defaultHandler()
Returns:
A simple ExceptionHandler that merely rethrows the exceptions it receives as arguments.

handle

public abstract void handle(E exception)
                     throws E extends java.lang.Exception
Handles the given exception, e.g. by printing, logging or rethrowing it.

Throws:
E extends java.lang.Exception

handle

public abstract void handle(java.lang.RuntimeException runtimeException)
Handles the given runtimeException, e.g. by printing, logging or rethrowing it.