Class FutureHelper

java.lang.Object
com.codingchili.core.context.FutureHelper

public abstract class FutureHelper extends Object
Helper method to simplify working with handlers and asyncresult.
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> io.vertx.core.Future<T>
    Creates a failed future from a throwable.
    static <T> io.vertx.core.Future<T>
    Creates a succeeded future with an empty result.
    static <T> io.vertx.core.Future<T>
    result​(T value)
    Creates a succeeded future from the given value.
    static <T> io.vertx.core.Promise<T>
    untyped​(io.vertx.core.Promise<?> typed)
    Converts the given untyped feature into an inferred type by wrapping.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • error

      public static <T> io.vertx.core.Future<T> error(Throwable e)
      Creates a failed future from a throwable.
      Type Parameters:
      T - inferred future type
      Parameters:
      e - the cause of the failure.
      Returns:
      a failed future with the given cause.
    • result

      public static <T> io.vertx.core.Future<T> result(T value)
      Creates a succeeded future from the given value.
      Type Parameters:
      T - inferred future type
      Parameters:
      value - the value that is the result
      Returns:
      a succeeded future with the given value.
    • result

      public static <T> io.vertx.core.Future<T> result()
      Creates a succeeded future with an empty result.
      Type Parameters:
      T - inferred future type
      Returns:
      a succeeded future with an empty result.
    • untyped

      public static <T> io.vertx.core.Promise<T> untyped(io.vertx.core.Promise<?> typed)
      Converts the given untyped feature into an inferred type by wrapping.
      Type Parameters:
      T - inferred future type
      Parameters:
      typed - future of any type
      Returns:
      a generic future with a handler set.