Coverage Summary for Class: ForwardingFluentFuture (com.google.common.util.concurrent)

Class Class, % Method, % Line, %
ForwardingFluentFuture 0% (0/1) 0% (0/8) 0% (0/11)


1 /* 2  * Copyright (C) 2009 The Guava Authors 3  * 4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5  * in compliance with the License. You may obtain a copy of the License at 6  * 7  * http://www.apache.org/licenses/LICENSE-2.0 8  * 9  * Unless required by applicable law or agreed to in writing, software distributed under the License 10  * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11  * or implied. See the License for the specific language governing permissions and limitations under 12  * the License. 13  */ 14  15 package com.google.common.util.concurrent; 16  17 import static com.google.common.base.Preconditions.checkNotNull; 18  19 import com.google.common.annotations.GwtCompatible; 20 import java.util.concurrent.ExecutionException; 21 import java.util.concurrent.Executor; 22 import java.util.concurrent.TimeUnit; 23 import java.util.concurrent.TimeoutException; 24 import org.checkerframework.checker.nullness.qual.Nullable; 25  26 /** 27  * {@link FluentFuture} that forwards all calls to a delegate. 28  * 29  * <h3>Extension</h3> 30  * 31  * If you want a class like {@code FluentFuture} but with extra methods, we recommend declaring your 32  * own subclass of {@link ListenableFuture}, complete with a method like {@link #from} to adapt an 33  * existing {@code ListenableFuture}, implemented atop a {@link ForwardingListenableFuture} that 34  * forwards to that future and adds the desired methods. 35  */ 36 @GwtCompatible 37 @ElementTypesAreNonnullByDefault 38 final class ForwardingFluentFuture<V extends @Nullable Object> extends FluentFuture<V> { 39  private final ListenableFuture<V> delegate; 40  41  ForwardingFluentFuture(ListenableFuture<V> delegate) { 42  this.delegate = checkNotNull(delegate); 43  } 44  45  @Override 46  public void addListener(Runnable listener, Executor executor) { 47  delegate.addListener(listener, executor); 48  } 49  50  @Override 51  public boolean cancel(boolean mayInterruptIfRunning) { 52  return delegate.cancel(mayInterruptIfRunning); 53  } 54  55  @Override 56  public boolean isCancelled() { 57  return delegate.isCancelled(); 58  } 59  60  @Override 61  public boolean isDone() { 62  return delegate.isDone(); 63  } 64  65  @Override 66  @ParametricNullness 67  public V get() throws InterruptedException, ExecutionException { 68  return delegate.get(); 69  } 70  71  @Override 72  @ParametricNullness 73  public V get(long timeout, TimeUnit unit) 74  throws InterruptedException, ExecutionException, TimeoutException { 75  return delegate.get(timeout, unit); 76  } 77  78  @Override 79  public String toString() { 80  return delegate.toString(); 81  } 82 }