C
- the type of the cause exceptions.X
- the type of the assembled exceptions.@NotThreadSafe public interface ExceptionBuilder<C extends Exception,X extends Exception> extends ExceptionHandler<C,X>
T
from one or more exceptions of the parameter
type C
.
This may be used in scenarios where a cooperative algorithm needs to
continue its task even if one or more exceptional conditions occur.
This interface would then allow to collect all cause exceptions during
the processing by calling warn(Exception)
and later check out the
assembled exception by calling fail(Exception)
or
check()
.
TODO: Consider allowing Throwable
as type parameters.
Modifier and Type | Method and Description |
---|---|
void |
check()
Either returns or checks out and throws
the result of the assembly
in order to enable the assembly of another exception.
|
X |
fail(C cause)
Adds the
cause exception to the assembly and
checks out and returns
the result
in order to enable the assembly of another exception. |
void |
warn(C cause)
Adds the
cause exception to the assembly and
either returns or checks out and throws
the result
in order to enable the assembly of another exception. |
void check() throws X extends Exception
X fail(C cause)
cause
exception to the assembly and
checks out and returns
the result
in order to enable the assembly of another exception.
Called to handle an exceptional condition which does not allow the caller to proceed its task. The implementation must return an appropriate exception to be thrown by the cooperative algorithm. Finally, if the implementation maintains a state, it must be updated so that this instance can be reused to handle more exceptions!
void warn(C cause) throws X extends Exception
cause
exception to the assembly and
either returns or checks out and throws
the result
in order to enable the assembly of another exception.
Called to handle an exceptional condition which
does
allow the caller to proceed its task.
The implementation may throw an exception of the parameter type
T
or return from the call.
If the implementation maintains a state, it must be updated
so that this instance can be reused to handle more exceptions.
Copyright © 2005–2018 Schlichtherle IT Services. All rights reserved.