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.

@FunctionalInterface public interface ThrowableSurrogateFactory<Ex extends Throwable>
Implements the creation of Throwable surrogates.
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    newSurrogate(Ex template, Throwable cause)
    Creates a new Throwable surrogate, when possible to create with a compatible state.
  • Method Details

    • newSurrogate

      Ex newSurrogate(Ex template, Throwable cause)
      Creates a new Throwable 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 with WrappedException or WrappedError.
      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.