Class Futures.MappingCheckedFuture<V,X extends java.lang.Exception>
- java.lang.Object
-
- com.google.common.collect.ForwardingObject
-
- com.google.common.util.concurrent.ForwardingFuture<V>
-
- com.google.common.util.concurrent.ForwardingListenableFuture<V>
-
- com.google.common.util.concurrent.ForwardingListenableFuture.SimpleForwardingListenableFuture<V>
-
- com.google.common.util.concurrent.AbstractCheckedFuture<V,X>
-
- com.google.common.util.concurrent.Futures.MappingCheckedFuture<V,X>
-
- All Implemented Interfaces:
CheckedFuture<V,X>
,ListenableFuture<V>
,java.util.concurrent.Future<V>
- Enclosing class:
- Futures
@GwtIncompatible private static class Futures.MappingCheckedFuture<V,X extends java.lang.Exception> extends AbstractCheckedFuture<V,X>
A checked future that uses a function to map from exceptions to the appropriate checked type.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.common.util.concurrent.ForwardingListenableFuture
ForwardingListenableFuture.SimpleForwardingListenableFuture<V>
-
Nested classes/interfaces inherited from class com.google.common.util.concurrent.ForwardingFuture
ForwardingFuture.SimpleForwardingFuture<V>
-
-
Constructor Summary
Constructors Constructor Description MappingCheckedFuture(ListenableFuture<V> delegate, Function<? super java.lang.Exception,X> mapper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected X
mapException(java.lang.Exception e)
Translates from anInterruptedException
,CancellationException
orExecutionException
thrown byget
to an exception of typeX
to be thrown bycheckedGet
.-
Methods inherited from class com.google.common.util.concurrent.AbstractCheckedFuture
checkedGet, checkedGet
-
Methods inherited from class com.google.common.util.concurrent.ForwardingListenableFuture.SimpleForwardingListenableFuture
delegate
-
Methods inherited from class com.google.common.util.concurrent.ForwardingListenableFuture
addListener
-
Methods inherited from class com.google.common.util.concurrent.ForwardingFuture
cancel, get, get, isCancelled, isDone
-
Methods inherited from class com.google.common.collect.ForwardingObject
toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.google.common.util.concurrent.ListenableFuture
addListener
-
-
-
-
Constructor Detail
-
MappingCheckedFuture
MappingCheckedFuture(ListenableFuture<V> delegate, Function<? super java.lang.Exception,X> mapper)
-
-
Method Detail
-
mapException
protected X mapException(java.lang.Exception e)
Description copied from class:AbstractCheckedFuture
Translates from anInterruptedException
,CancellationException
orExecutionException
thrown byget
to an exception of typeX
to be thrown bycheckedGet
. Subclasses must implement this method.If
e
is anInterruptedException
, the callingcheckedGet
method has already restored the interrupt after catching the exception. If an implementation ofAbstractCheckedFuture.mapException(Exception)
wishes to swallow the interrupt, it can do so by callingThread.interrupted()
.Subclasses may choose to throw, rather than return, a subclass of
RuntimeException
to allow creating a CheckedFuture that throws both checked and unchecked exceptions.- Specified by:
mapException
in classAbstractCheckedFuture<V,X extends java.lang.Exception>
-
-