FROM
- The type returned by the delegate Future.TO
- The type to convert to.public class TransformingFuture<FROM,TO> extends Object implements Future<TO>
Future that both delegates to another one and provides the ability to transform the response to another type.
Constructor and Description |
---|
TransformingFuture(Future<FROM> delegate,
Function<FROM,TO> transformer) |
Modifier and Type | Method and Description |
---|---|
boolean |
cancel(boolean mayInterruptIfRunning) |
TO |
get() |
TO |
get(long timeout,
TimeUnit unit) |
boolean |
isCancelled() |
boolean |
isDone() |
public boolean cancel(boolean mayInterruptIfRunning)
public boolean isCancelled()
isCancelled
in interface Future<TO>
public TO get() throws InterruptedException, ExecutionException
get
in interface Future<TO>
InterruptedException
ExecutionException
public TO get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
get
in interface Future<TO>
InterruptedException
ExecutionException
TimeoutException
Copyright © 2016–2024. All rights reserved.