org.omnaest.utils.events.exception
Class ExceptionHandlerManager

java.lang.Object
  extended by org.omnaest.utils.events.exception.ExceptionHandlerManager

public class ExceptionHandlerManager
extends Object

An ExceptionHandlerManager will manage instances of ExceptionHandlerManager.DispatchingExceptionHandlers

Author:
Omnaest

Nested Class Summary
protected  class ExceptionHandlerManager.DispatchingExceptionHandler
          ExceptionHandler which dispatches to the exceptionHandlerSet.
protected  class ExceptionHandlerManager.DispatchingExceptionHandlerRethrowingExceptions
          ExceptionHandler which dispatches to the exceptionHandlerSet rethrowing any Exception as RuntimeException
 class ExceptionHandlerManager.ExceptionHandlerRegistration
          Registration for ExceptionHandler
 
Field Summary
protected  ExceptionHandler dispatchingExceptionHandler
           
protected  ExceptionHandler dispatchingExceptionHandlerRethrowingExceptions
           
protected  ExceptionHandlerManager.ExceptionHandlerRegistration exceptionHandlerRegistration
           
protected  Set<ExceptionHandler> exceptionHandlerSet
           
 
Constructor Summary
ExceptionHandlerManager()
           
 
Method Summary
 ExceptionHandlerManager clearExceptionHandlers()
          Unregisters all registered ExceptionHandlerManager.DispatchingExceptionHandlers
<R,P> R
executeOperationAndHandleAnyException(Operation<R,P> operation, P parameter)
          Invokes Operation.execute(Object) with the given parameter and handles any occurring Exception
<R,P> ExceptionHandlerManager
executeOperationAndHandleAnyException(OperationIntrinsic operationIntrinsic)
          Invokes OperationIntrinsic.execute() with the given parameter and handles any occurring Exception
 ExceptionHandler getExceptionHandler()
           
 ExceptionHandlerManager.ExceptionHandlerRegistration getExceptionHandlerRegistration()
           
 ExceptionHandlerManager setRethrowingExceptionsFromExceptionHandler(boolean isRethrowingExceptionsFromExceptionHandler)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dispatchingExceptionHandler

protected final ExceptionHandler dispatchingExceptionHandler

dispatchingExceptionHandlerRethrowingExceptions

protected final ExceptionHandler dispatchingExceptionHandlerRethrowingExceptions

exceptionHandlerSet

protected final Set<ExceptionHandler> exceptionHandlerSet

exceptionHandlerRegistration

protected final ExceptionHandlerManager.ExceptionHandlerRegistration exceptionHandlerRegistration
Constructor Detail

ExceptionHandlerManager

public ExceptionHandlerManager()
Method Detail

getExceptionHandlerRegistration

public ExceptionHandlerManager.ExceptionHandlerRegistration getExceptionHandlerRegistration()
Returns:
the exceptionHandlerRegistration

getExceptionHandler

public ExceptionHandler getExceptionHandler()
Returns:
the exceptionHandler

clearExceptionHandlers

public ExceptionHandlerManager clearExceptionHandlers()
Unregisters all registered ExceptionHandlerManager.DispatchingExceptionHandlers

Returns:
this

executeOperationAndHandleAnyException

public <R,P> ExceptionHandlerManager executeOperationAndHandleAnyException(OperationIntrinsic operationIntrinsic)
Invokes OperationIntrinsic.execute() with the given parameter and handles any occurring Exception

Parameters:
operationIntrinsic -
Returns:
this

executeOperationAndHandleAnyException

public <R,P> R executeOperationAndHandleAnyException(Operation<R,P> operation,
                                                     P parameter)
Invokes Operation.execute(Object) with the given parameter and handles any occurring Exception

Parameters:
operation -
parameter -
Returns:

setRethrowingExceptionsFromExceptionHandler

public ExceptionHandlerManager setRethrowingExceptionsFromExceptionHandler(boolean isRethrowingExceptionsFromExceptionHandler)
Parameters:
isRethrowingExceptionsFromExceptionHandler - the isRethrowingExceptionsFromExceptionHandler to set
Returns:
this


Copyright © 2013. All Rights Reserved.