Class RestconfFuture<V>

java.lang.Object
com.google.common.util.concurrent.internal.InternalFutureFailureAccess
com.google.common.util.concurrent.AbstractFuture<@NonNull V>
org.opendaylight.restconf.common.errors.RestconfFuture<V>
Type Parameters:
V - resulting value type
All Implemented Interfaces:
com.google.common.util.concurrent.ListenableFuture<V>, Future<V>
Direct Known Subclasses:
SettableRestconfFuture

public sealed class RestconfFuture<V> extends com.google.common.util.concurrent.AbstractFuture<@NonNull V> permits SettableRestconfFuture<V>
A ListenableFuture specialization, which fails only with RestconfDocumentedException and does not produce null values.
  • Method Details

    • of

      public static <V> @NonNull RestconfFuture<V> of(V value)
    • failed

      public static <V> @NonNull RestconfFuture<V> failed(RestconfDocumentedException cause)
    • cancel

      public final boolean cancel(boolean mayInterruptIfRunning)
      Specified by:
      cancel in interface Future<V>
      Overrides:
      cancel in class com.google.common.util.concurrent.AbstractFuture<@NonNull V>
    • addCallback

      public final @NonNull RestconfFuture<V> addCallback(RestconfCallback<? super V> callback)
      Add a callback to invoke when this future completes, or immediately if it is already complete.
      Parameters:
      callback - Callback to invoke
      Returns:
      This future
      Throws:
      NullPointerException - if callback is null
    • transform

      public final <T> @NonNull RestconfFuture<T> transform(Function<@NonNull V,@NonNull T> function)
      Transform the result of this future using the specified function.
      Type Parameters:
      T - Resulting type
      Parameters:
      function - Function to apply
      Returns:
      Transformed future
      Throws:
      NullPointerException - if function is null
    • getOrThrow

      public final @NonNull V getOrThrow()
      Get the result.
      Returns:
      The result
      Throws:
      RestconfDocumentedException - if this future failed or this call is interrupted.