Module com.aoapps.lang
Package com.aoapps.lang
Interface ThrowableSurrogateFactory<Ex extends Throwable>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Implements the creation of
Throwable
surrogates.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionnewSurrogate
(Ex template, Throwable cause) Creates a newThrowable
surrogate, when possible to create with a compatible state.
-
Method Details
-
newSurrogate
Creates a newThrowable
surrogate, when possible to create with a compatible state.- Parameters:
template
- The created surrogate must be of the same type as the template, and must include all template-type-specific state. If unable to copy the state, then no surrogate should be created.cause
- The cause that should be used for the newly created surrogate. This may or may not be the same as the template. This may or may not have the template in its change of causes or suppression lists. It is allowed to further wrap the cause if necessary to create the surrogate, such as withWrappedException
orWrappedError
.- Returns:
- A new throwable instance of the same type as the template, with compatible state, and the given cause
either directly or wrapped. If unable to create a compatible surrogate, returns
null
.
-