public final class ThrowableExtensions
extends java.lang.Object
ThrowableExtensions| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
getStackTrace(java.lang.Throwable throwable,
java.lang.String... additionalInfos)
Gets the stacktrace as a
String object. |
static java.lang.String |
getStackTraceElements(java.lang.Throwable throwable,
java.lang.String... additionalInfos)
Gets the stack trace elements from the given Throwable and returns a
String object
from it. |
static java.lang.String |
newThrowableMessage(java.lang.Throwable throwable,
java.lang.String additionalInfo)
Factory method for create the message from the given throwable object as a
String
object. |
static <T> java.util.function.Consumer<T> |
toRuntimeExceptionIfNeeded(ThrowableConsumer<T,java.lang.Throwable> throwableConsumer)
Consume and if an checked exception occurs it is decorated in to a
RuntimeException and will be thrown. |
public static <T> java.util.function.Consumer<T> toRuntimeExceptionIfNeeded(ThrowableConsumer<T,java.lang.Throwable> throwableConsumer)
RuntimeException and will be thrown. Useful in lambda expressions, for examples
see unit testsT - the generic typethrowableConsumer - the throwable consumerpublic static java.lang.String getStackTrace(java.lang.Throwable throwable,
java.lang.String... additionalInfos)
throws java.io.IOException
String object. throwable - the Throwable objectadditionalInfos - the additional infosString objectjava.io.IOException - Signals that an I/O exception has occurredpublic static java.lang.String getStackTraceElements(java.lang.Throwable throwable,
java.lang.String... additionalInfos)
throws java.io.IOException
String object
from it.throwable - the throwableadditionalInfos - the additional information to the given throwablejava.io.IOException - Signals that an I/O exception has occurredpublic static java.lang.String newThrowableMessage(java.lang.Throwable throwable,
java.lang.String additionalInfo)
String
object. throwable - the throwableadditionalInfo - the additional info