|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.emarsys.ecommon.exceptions.handling.ExceptionHandlerPool
public class ExceptionHandlerPool
ExceptionHandlerPool
represents some kind of default
implementation of the ExceptionHandling
interface
with almost no restrictions.
NOTE: the whole pluggable exception handling (PEH) module is highly experimental and still under heavy development, don't use it in production code unless you know what you're doing!
Field Summary | |
---|---|
protected java.util.Map<ExceptionScenario<?,?>,ExceptionHandler<?,?>> |
pool
|
Constructor Summary | |
---|---|
ExceptionHandlerPool()
|
Method Summary | ||
---|---|---|
|
getExceptionHandler(ExceptionScenario<E,T> scenario)
|
|
java.util.Map<ExceptionScenario<?,?>,ExceptionHandler<?,?>> |
getExceptionHandlers()
The passed Map must not be the ExceptionHandling 's
interal, modifyable representation in order to protect from
violating invariants. |
|
|
registerExceptionHandler(ExceptionScenario<E,T> scenario,
ExceptionHandler<E,T> handler)
|
|
ExceptionHandling |
unionExceptionHandling(ExceptionHandling handling)
Will add all ExceptionHandler s from the passed handling
and overwrite already existing ones; already registered distinct
handlers will remain registered. |
|
|
unregisterExceptionHandler(ExceptionScenario<E,T> scenario)
Unregisters the ExceptionHandler associated with the
passed scenario if present. |
|
ExceptionHandling |
useExceptionHandling(ExceptionHandling handling)
Will overwrite this exception handlings behavior with the passed instance's one. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected volatile java.util.Map<ExceptionScenario<?,?>,ExceptionHandler<?,?>> pool
Constructor Detail |
---|
public ExceptionHandlerPool()
Method Detail |
---|
public <E extends java.lang.Exception,T extends java.lang.Exception> ExceptionHandler<E,T> getExceptionHandler(ExceptionScenario<E,T> scenario)
getExceptionHandler
in interface ExceptionHandling
ExceptionHandler
registered for the passed
ExceptionScenario
or null
if not present.ExceptionHandling.getExceptionHandler(com.emarsys.ecommon.exceptions.handling.ExceptionScenario)
public java.util.Map<ExceptionScenario<?,?>,ExceptionHandler<?,?>> getExceptionHandlers()
ExceptionHandling
The passed Map
must not be the ExceptionHandling
's
interal, modifyable representation in order to protect from
violating invariants. So the returned map might be a copy or
a an immutable proxy of the exception handlings internal state.
getExceptionHandlers
in interface ExceptionHandling
ExceptionHandler
s registered with this instance
togheter with their associated ExceptionScenario
s
but never null
, if no handler is present an empty
Map
will be returned.
ExceptionHandling.getExceptionHandlers()
public <E extends java.lang.Exception,T extends java.lang.Exception> void registerExceptionHandler(ExceptionScenario<E,T> scenario, ExceptionHandler<E,T> handler)
registerExceptionHandler
in interface ExceptionHandling
ExceptionHandling.registerExceptionHandler(com.emarsys.ecommon.exceptions.handling.ExceptionScenario, com.emarsys.ecommon.exceptions.handling.ExceptionHandler)
public <E extends java.lang.Exception,T extends java.lang.Exception> void unregisterExceptionHandler(ExceptionScenario<E,T> scenario)
ExceptionHandling
ExceptionHandler
associated with the
passed scenario if present.
unregisterExceptionHandler
in interface ExceptionHandling
ExceptionHandling.unregisterExceptionHandler(com.emarsys.ecommon.exceptions.handling.ExceptionScenario)
public ExceptionHandling unionExceptionHandling(ExceptionHandling handling)
ExceptionHandling
ExceptionHandler
s from the passed handling
and overwrite already existing ones; already registered distinct
handlers will remain registered.
unionExceptionHandling
in interface ExceptionHandling
ExceptionHandling
now in use.ExceptionHandling.unionExceptionHandling(com.emarsys.ecommon.exceptions.handling.ExceptionHandling)
public ExceptionHandling useExceptionHandling(ExceptionHandling handling)
ExceptionHandling
useExceptionHandling
in interface ExceptionHandling
ExceptionHandling
now in use, needs not to
be the same (identical) instance as the passed one.ExceptionHandling.useExceptionHandling(com.emarsys.ecommon.exceptions.handling.ExceptionHandling)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |