com.googlecode.catchexception.throwable.internal
Class ThrowableHolder
java.lang.Object
com.googlecode.catchexception.throwable.internal.ThrowableHolder
public class ThrowableHolder
- extends Object
Holds a caught throwable per Thread.
- Author:
- rwoo
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
caughtThrowable
private static final ThreadLocal<Throwable> caughtThrowable
- The container for the most recently caught throwable.
There is no need to use weak references here as all
the code is for testing so that we don't have to care about memory leaks.
ThrowableHolder
public ThrowableHolder()
set
public static <E extends Throwable> void set(E caughtThrowable)
- Saves the given throwable in
caughtThrowable.
- Type Parameters:
E - the type of the caught throwable- Parameters:
caughtThrowable - the caught throwable
get
public static <E extends Throwable> E get()
- Type Parameters:
E - the type of the caught throwable
- Returns:
- Returns the caught throwable. Returns null if there is no
throwable caught.
Copyright © 2015. All rights reserved.