Class JsObjFuture

  • All Implemented Interfaces:
    Supplier<CompletableFuture<JsObj>>, JsFuture<JsObj>

    public class JsObjFuture
    extends Object
    implements JsFuture<JsObj>
    Represents a supplier of a completable future which result is a json object. It has the same recursive structure as a json object. Each key has a completable future associated that it's executed asynchronously. When all the futures are completed, all the results are combined into a json object: JsObjFuture(a-> CompletableFuture(1), b-> CompletableFuture("a"), c-> CompletableFuture(true) ) = CompletableFuture(JsObj(a->1, b->"a", c->true ) )
    • Method Detail

      • of

        public static JsObjFuture of​(String key,
                                     JsFuture<?> fut)
        static factory method to create a JsObjFuture of one mapping
        Parameters:
        key - the key
        fut - the mapping associated to the key
        Returns:
        a JsObjFuture
      • of

        public static JsObjFuture of​(String key1,
                                     JsFuture<?> fut1,
                                     String key2,
                                     JsFuture<?> fut2)
        static factory method to create a JsObjFuture of one mapping
        Parameters:
        key1 - the first key
        fut1 - the mapping associated to the first key
        key2 - the second key
        fut2 - the mapping associated to the second key
        Returns:
        a JsObjFuture
      • of

        public static JsObjFuture of​(String key1,
                                     JsFuture<?> fut1,
                                     String key2,
                                     JsFuture<?> fut2,
                                     String key3,
                                     JsFuture<?> fut3)
        static factory method to create a JsObjFuture of three mappings
        Parameters:
        key1 - the first key
        fut1 - the mapping associated to the first key
        key2 - the second key
        fut2 - the mapping associated to the second key
        key3 - the third key
        fut3 - the mapping associated to the third key
        Returns:
        a JsObjFuture
      • of

        public static JsObjFuture of​(String key1,
                                     JsFuture<?> fut1,
                                     String key2,
                                     JsFuture<?> fut2,
                                     String key3,
                                     JsFuture<?> fut3,
                                     String key4,
                                     JsFuture<?> fut4)
        static factory method to create a JsObjFuture of four mappings
        Parameters:
        key1 - the first key
        fut1 - the mapping associated to the first key
        key2 - the second key
        fut2 - the mapping associated to the second key
        key3 - the third key
        fut3 - the mapping associated to the third key
        key4 - the fourth key
        fut4 - the mapping associated to the fourth key
        Returns:
        a JsObjFuture
      • of

        public static JsObjFuture of​(String key1,
                                     JsFuture<?> fut1,
                                     String key2,
                                     JsFuture<?> fut2,
                                     String key3,
                                     JsFuture<?> fut3,
                                     String key4,
                                     JsFuture<?> fut4,
                                     String key5,
                                     JsFuture<?> fut5)
        static factory method to create a JsObjFuture of five mappings
        Parameters:
        key1 - the first key
        fut1 - the mapping associated to the first key
        key2 - the second key
        fut2 - the mapping associated to the second key
        key3 - the third key
        fut3 - the mapping associated to the third key
        key4 - the fourth key
        fut4 - the mapping associated to the fourth key
        key5 - the fifth key
        fut5 - the mapping associated to the fifth key
        Returns:
        a JsObjFuture
      • of

        public static JsObjFuture of​(String key1,
                                     JsFuture<?> fut1,
                                     String key2,
                                     JsFuture<?> fut2,
                                     String key3,
                                     JsFuture<?> fut3,
                                     String key4,
                                     JsFuture<?> fut4,
                                     String key5,
                                     JsFuture<?> fut5,
                                     String key6,
                                     JsFuture<?> fut6)
        static factory method to create a JsObjFuture of six mappings
        Parameters:
        key1 - the first key
        fut1 - the mapping associated to the first key
        key2 - the second key
        fut2 - the mapping associated to the second key
        key3 - the third key
        fut3 - the mapping associated to the third key
        key4 - the fourth key
        fut4 - the mapping associated to the fourth key
        key5 - the fifth key
        fut5 - the mapping associated to the fifth key
        key6 - the sixth key
        fut6 - the mapping associated to the sixth key
        Returns:
        a JsObjFuture
      • of

        public static JsObjFuture of​(String key1,
                                     JsFuture<?> fut1,
                                     String key2,
                                     JsFuture<?> fut2,
                                     String key3,
                                     JsFuture<?> fut3,
                                     String key4,
                                     JsFuture<?> fut4,
                                     String key5,
                                     JsFuture<?> fut5,
                                     String key6,
                                     JsFuture<?> fut6,
                                     String key7,
                                     JsFuture<?> fut7)
        static factory method to create a JsObjFuture of seven mappings
        Parameters:
        key1 - the first key
        fut1 - the mapping associated to the first key
        key2 - the second key
        fut2 - the mapping associated to the second key
        key3 - the third key
        fut3 - the mapping associated to the third key
        key4 - the fourth key
        fut4 - the mapping associated to the fourth key
        key5 - the fifth key
        fut5 - the mapping associated to the fifth key
        key6 - the sixth key
        fut6 - the mapping associated to the sixth key
        key7 - the seventh key
        fut7 - the mapping associated to the seventh key
        Returns:
        a JsObjFuture
      • of

        public static JsObjFuture of​(String key1,
                                     JsFuture<?> fut1,
                                     String key2,
                                     JsFuture<?> fut2,
                                     String key3,
                                     JsFuture<?> fut3,
                                     String key4,
                                     JsFuture<?> fut4,
                                     String key5,
                                     JsFuture<?> fut5,
                                     String key6,
                                     JsFuture<?> fut6,
                                     String key7,
                                     JsFuture<?> fut7,
                                     String key8,
                                     JsFuture<?> fut8)
        static factory method to create a JsObjFuture of eight mappings
        Parameters:
        key1 - the first key
        fut1 - the mapping associated to the first key
        key2 - the second key
        fut2 - the mapping associated to the second key
        key3 - the third key
        fut3 - the mapping associated to the third key
        key4 - the fourth key
        fut4 - the mapping associated to the fourth key
        key5 - the fifth key
        fut5 - the mapping associated to the fifth key
        key6 - the sixth key
        fut6 - the mapping associated to the sixth key
        key7 - the seventh key
        fut7 - the mapping associated to the seventh key
        key8 - the eighth key
        fut8 - the mapping associated to the eighth key
        Returns:
        a JsObjFuture
      • of

        public static JsObjFuture of​(String key1,
                                     JsFuture<?> fut1,
                                     String key2,
                                     JsFuture<?> fut2,
                                     String key3,
                                     JsFuture<?> fut3,
                                     String key4,
                                     JsFuture<?> fut4,
                                     String key5,
                                     JsFuture<?> fut5,
                                     String key6,
                                     JsFuture<?> fut6,
                                     String key7,
                                     JsFuture<?> fut7,
                                     String key8,
                                     JsFuture<?> fut8,
                                     String key9,
                                     JsFuture<?> fut9)
        static factory method to create a JsObjFuture of nine mappings
        Parameters:
        key1 - the first key
        fut1 - the mapping associated to the first key
        key2 - the second key
        fut2 - the mapping associated to the second key
        key3 - the third key
        fut3 - the mapping associated to the third key
        key4 - the fourth key
        fut4 - the mapping associated to the fourth key
        key5 - the fifth key
        fut5 - the mapping associated to the fifth key
        key6 - the sixth key
        fut6 - the mapping associated to the sixth key
        key7 - the seventh key
        fut7 - the mapping associated to the seventh key
        key8 - the eighth key
        fut8 - the mapping associated to the eighth key
        key9 - the ninth key
        fut9 - the mapping associated to the ninth key
        Returns:
        a JsObjFuture
      • of

        public static JsObjFuture of​(String key1,
                                     JsFuture<?> fut1,
                                     String key2,
                                     JsFuture<?> fut2,
                                     String key3,
                                     JsFuture<?> fut3,
                                     String key4,
                                     JsFuture<?> fut4,
                                     String key5,
                                     JsFuture<?> fut5,
                                     String key6,
                                     JsFuture<?> fut6,
                                     String key7,
                                     JsFuture<?> fut7,
                                     String key8,
                                     JsFuture<?> fut8,
                                     String key9,
                                     JsFuture<?> fut9,
                                     String key10,
                                     JsFuture<?> fut10)
        static factory method to create a JsObjFuture of ten mappings
        Parameters:
        key1 - the first key
        fut1 - the mapping associated to the first key
        key2 - the second key
        fut2 - the mapping associated to the second key
        key3 - the third key
        fut3 - the mapping associated to the third key
        key4 - the fourth key
        fut4 - the mapping associated to the fourth key
        key5 - the fifth key
        fut5 - the mapping associated to the fifth key
        key6 - the sixth key
        fut6 - the mapping associated to the sixth key
        key7 - the seventh key
        fut7 - the mapping associated to the seventh key
        key8 - the eighth key
        fut8 - the mapping associated to the eighth key
        key9 - the ninth key
        fut9 - the mapping associated to the ninth key
        key10 - the tenth key
        fut10 - the mapping associated to the tenth key
        Returns:
        a JsObjFuture
      • of

        public static JsObjFuture of​(String key1,
                                     JsFuture<?> fut1,
                                     String key2,
                                     JsFuture<?> fut2,
                                     String key3,
                                     JsFuture<?> fut3,
                                     String key4,
                                     JsFuture<?> fut4,
                                     String key5,
                                     JsFuture<?> fut5,
                                     String key6,
                                     JsFuture<?> fut6,
                                     String key7,
                                     JsFuture<?> fut7,
                                     String key8,
                                     JsFuture<?> fut8,
                                     String key9,
                                     JsFuture<?> fut9,
                                     String key10,
                                     JsFuture<?> fut10,
                                     String key11,
                                     JsFuture<?> fut11)
        static factory method to create a JsObjFuture of eleven mappings
        Parameters:
        key1 - the first key
        fut1 - the mapping associated to the first key
        key2 - the second key
        fut2 - the mapping associated to the second key
        key3 - the third key
        fut3 - the mapping associated to the third key
        key4 - the fourth key
        fut4 - the mapping associated to the fourth key
        key5 - the fifth key
        fut5 - the mapping associated to the fifth key
        key6 - the sixth key
        fut6 - the mapping associated to the sixth key
        key7 - the seventh key
        fut7 - the mapping associated to the seventh key
        key8 - the eighth key
        fut8 - the mapping associated to the eighth key
        key9 - the ninth key
        fut9 - the mapping associated to the ninth key
        key10 - the tenth key
        fut10 - the mapping associated to the eleventh key
        key11 - the tenth key
        fut11 - the mapping associated to the eleventh key
        Returns:
        a JsObjFuture
      • of

        public static JsObjFuture of​(String key1,
                                     JsFuture<?> fut1,
                                     String key2,
                                     JsFuture<?> fut2,
                                     String key3,
                                     JsFuture<?> fut3,
                                     String key4,
                                     JsFuture<?> fut4,
                                     String key5,
                                     JsFuture<?> fut5,
                                     String key6,
                                     JsFuture<?> fut6,
                                     String key7,
                                     JsFuture<?> fut7,
                                     String key8,
                                     JsFuture<?> fut8,
                                     String key9,
                                     JsFuture<?> fut9,
                                     String key10,
                                     JsFuture<?> fut10,
                                     String key11,
                                     JsFuture<?> fut11,
                                     String key12,
                                     JsFuture<?> fut12)
        static factory method to create a JsObjFuture of twelve mappings
        Parameters:
        key1 - the first key
        fut1 - the mapping associated to the first key
        key2 - the second key
        fut2 - the mapping associated to the second key
        key3 - the third key
        fut3 - the mapping associated to the third key
        key4 - the fourth key
        fut4 - the mapping associated to the fourth key
        key5 - the fifth key
        fut5 - the mapping associated to the fifth key
        key6 - the sixth key
        fut6 - the mapping associated to the sixth key
        key7 - the seventh key
        fut7 - the mapping associated to the seventh key
        key8 - the eighth key
        fut8 - the mapping associated to the eighth key
        key9 - the ninth key
        fut9 - the mapping associated to the ninth key
        key10 - the tenth key
        fut10 - the mapping associated to the eleventh key
        key11 - the eleventh key
        fut11 - the mapping associated to the eleventh key
        key12 - the twelfth key
        fut12 - the mapping associated to the twelfth key
        Returns:
        a JsObjFuture
      • of

        public static JsObjFuture of​(String key1,
                                     JsFuture<?> fut1,
                                     String key2,
                                     JsFuture<?> fut2,
                                     String key3,
                                     JsFuture<?> fut3,
                                     String key4,
                                     JsFuture<?> fut4,
                                     String key5,
                                     JsFuture<?> fut5,
                                     String key6,
                                     JsFuture<?> fut6,
                                     String key7,
                                     JsFuture<?> fut7,
                                     String key8,
                                     JsFuture<?> fut8,
                                     String key9,
                                     JsFuture<?> fut9,
                                     String key10,
                                     JsFuture<?> fut10,
                                     String key11,
                                     JsFuture<?> fut11,
                                     String key12,
                                     JsFuture<?> fut12,
                                     String key13,
                                     JsFuture<?> fut13)
        static factory method to create a JsObjFuture of thirteen mappings
        Parameters:
        key1 - the first key
        fut1 - the mapping associated to the first key
        key2 - the second key
        fut2 - the mapping associated to the second key
        key3 - the third key
        fut3 - the mapping associated to the third key
        key4 - the fourth key
        fut4 - the mapping associated to the fourth key
        key5 - the fifth key
        fut5 - the mapping associated to the fifth key
        key6 - the sixth key
        fut6 - the mapping associated to the sixth key
        key7 - the seventh key
        fut7 - the mapping associated to the seventh key
        key8 - the eighth key
        fut8 - the mapping associated to the eighth key
        key9 - the ninth key
        fut9 - the mapping associated to the ninth key
        key10 - the tenth key
        fut10 - the mapping associated to the eleventh key
        key11 - the eleventh key
        fut11 - the mapping associated to the eleventh key
        key12 - the twelfth key
        fut12 - the mapping associated to the twelfth key,
        key13 - the thirteenth key
        fut13 - the mapping associated to the thirteenth key
        Returns:
        a JsObjFuture
      • of

        public static JsObjFuture of​(String key1,
                                     JsFuture<?> fut1,
                                     String key2,
                                     JsFuture<?> fut2,
                                     String key3,
                                     JsFuture<?> fut3,
                                     String key4,
                                     JsFuture<?> fut4,
                                     String key5,
                                     JsFuture<?> fut5,
                                     String key6,
                                     JsFuture<?> fut6,
                                     String key7,
                                     JsFuture<?> fut7,
                                     String key8,
                                     JsFuture<?> fut8,
                                     String key9,
                                     JsFuture<?> fut9,
                                     String key10,
                                     JsFuture<?> fut10,
                                     String key11,
                                     JsFuture<?> fut11,
                                     String key12,
                                     JsFuture<?> fut12,
                                     String key13,
                                     JsFuture<?> fut13,
                                     String key14,
                                     JsFuture<?> fut14)
        static factory method to create a JsObjFuture of fourteen mappings
        Parameters:
        key1 - the first key
        fut1 - the mapping associated to the first key
        key2 - the second key
        fut2 - the mapping associated to the second key
        key3 - the third key
        fut3 - the mapping associated to the third key
        key4 - the fourth key
        fut4 - the mapping associated to the fourth key
        key5 - the fifth key
        fut5 - the mapping associated to the fifth key
        key6 - the sixth key
        fut6 - the mapping associated to the sixth key
        key7 - the seventh key
        fut7 - the mapping associated to the seventh key
        key8 - the eighth key
        fut8 - the mapping associated to the eighth key
        key9 - the ninth key
        fut9 - the mapping associated to the ninth key
        key10 - the tenth key
        fut10 - the mapping associated to the eleventh key
        key11 - the eleventh key
        fut11 - the mapping associated to the eleventh key
        key12 - the twelfth key
        fut12 - the mapping associated to the twelfth key,
        key13 - the thirteenth key
        fut13 - the mapping associated to the thirteenth key
        key14 - the fourteenth key
        fut14 - the mapping associated to the fourteenth key
        Returns:
        a JsObjFuture
      • of

        public static JsObjFuture of​(String key1,
                                     JsFuture<?> fut1,
                                     String key2,
                                     JsFuture<?> fut2,
                                     String key3,
                                     JsFuture<?> fut3,
                                     String key4,
                                     JsFuture<?> fut4,
                                     String key5,
                                     JsFuture<?> fut5,
                                     String key6,
                                     JsFuture<?> fut6,
                                     String key7,
                                     JsFuture<?> fut7,
                                     String key8,
                                     JsFuture<?> fut8,
                                     String key9,
                                     JsFuture<?> fut9,
                                     String key10,
                                     JsFuture<?> fut10,
                                     String key11,
                                     JsFuture<?> fut11,
                                     String key12,
                                     JsFuture<?> fut12,
                                     String key13,
                                     JsFuture<?> fut13,
                                     String key14,
                                     JsFuture<?> fut14,
                                     String key15,
                                     JsFuture<?> fut15)
        static factory method to create a JsObjFuture of fifteen mappings
        Parameters:
        key1 - the first key
        fut1 - the mapping associated to the first key
        key2 - the second key
        fut2 - the mapping associated to the second key
        key3 - the third key
        fut3 - the mapping associated to the third key
        key4 - the fourth key
        fut4 - the mapping associated to the fourth key
        key5 - the fifth key
        fut5 - the mapping associated to the fifth key
        key6 - the sixth key
        fut6 - the mapping associated to the sixth key
        key7 - the seventh key
        fut7 - the mapping associated to the seventh key
        key8 - the eighth key
        fut8 - the mapping associated to the eighth key
        key9 - the ninth key
        fut9 - the mapping associated to the ninth key
        key10 - the tenth key
        fut10 - the mapping associated to the eleventh key
        key11 - the eleventh key
        fut11 - the mapping associated to the eleventh key
        key12 - the twelfth key
        fut12 - the mapping associated to the twelfth key,
        key13 - the thirteenth key
        fut13 - the mapping associated to the thirteenth key
        key14 - the fourteenth key
        fut14 - the mapping associated to the fourteenth key
        key15 - the fifteenth key
        fut15 - the mapping associated to the fifteenth key
        Returns:
        a JsObjFuture
      • empty

        public static JsObjFuture empty()
        returns a JsObjFuture that is completed returning the empty Json object
        Returns:
        a JsObjFuture
      • set

        public JsObjFuture set​(String key,
                               JsFuture<?> future)
        returns a new object future inserting the given future at the given key
        Parameters:
        key - the given key
        future - the given future
        Returns:
        a new JsObjFuture
      • executor

        public JsObjFuture executor​(Executor executor)
        the executor to use for the asynchronous operation assigned to this future. By default the ForkJoinPool.commonPool() will be used. Notice that any future associated to the keys can run on threads froms different executors. The job to do by this JsObjFuture is to iterate the pairs (key,future), trigger every future and compose the result of every completed future to the final json object that will be returned.
        Parameters:
        executor - the executor
        Returns:
        the same this JsObjFuture