# Class: CompositeFuture

## vertx-js/composite_future~ CompositeFuture

#### new CompositeFuture()

Source:
  - vertx-js/composite_future.js, line 29

### Methods

#### cause(index) → {todo}

Returns a cause of a wrapped future

##### Parameters:

Name | Type | Description
--- | --- | ---
`index` | number | the wrapped future index

Source:
  - vertx-js/composite_future.js, line 134

##### Returns:

Type
  todo

#### complete(result)

Set the result. Any handler will be called, if there is one, and the future will be marked as completed.

##### Parameters:

Name | Type | Description
--- | --- | ---
`result` | CompositeFuture | the result

Source:
  - vertx-js/composite_future.js, line 57

#### completer() → {function}

Source:
  - vertx-js/composite_future.js, line 254

##### Returns:

an handler completing this future

Type
  function

#### compose(handler, next) → {Future}

Compose this future with a provided `next` future.

When this (the one on which `compose` is called) future succeeds, the `handler` will be called with the completed value, this handler should complete the next future.

If the `handler` throws an exception, the returned future will be failed with this exception.

When this future fails, the failure will be propagated to the `next` future and the `handler` will not be called.

##### Parameters:

Name | Type | Description
--- | --- | ---
`handler` | function | the handler
`next` | Future | the next future

Source:
  - vertx-js/composite_future.js, line 191

##### Returns:

the next future, used for chaining

Type
  Future

#### fail(failureMessage)

Try to set the failure. When it happens, any handler will be called, if there is one, and the future will be marked as completed.

##### Parameters:

Name | Type | Description
--- | --- | ---
`failureMessage` | string | the failure message

Source:
  - vertx-js/composite_future.js, line 72

#### failed(index) → {boolean}

Returns true if a wrapped future is failed

##### Parameters:

Name | Type | Description
--- | --- | ---
`index` | number | the wrapped future index

Source:
  - vertx-js/composite_future.js, line 166

##### Returns:

Type
  boolean

#### isComplete(index) → {boolean}

Returns true if a wrapped future is completed

##### Parameters:

Name | Type | Description
--- | --- | ---
`index` | number | the wrapped future index

Source:
  - vertx-js/composite_future.js, line 42

##### Returns:

Type
  boolean

#### map(value) → {Future}

Map the result of a future to a specific `value`.

When this future succeeds, this `value` will complete the future returned by this method call.

When this future fails, the failure will be propagated to the returned future.

##### Parameters:

Name | Type | Description
--- | --- | ---
`value` | Object | the value that eventually completes the mapped future

Source:
  - vertx-js/composite_future.js, line 216

##### Returns:

the mapped future

Type
  Future

#### mapEmpty() → {Future}

Map the result of a future to `null`.

This is a conveniency for `future.map((T) null)` or `future.map((Void) null)`.

When this future succeeds, `null` will complete the future returned by this method call.

When this future fails, the failure will be propagated to the returned future.

Source:
  - vertx-js/composite_future.js, line 241

##### Returns:

the mapped future

Type
  Future

#### otherwise(value) → {Future}

Map the failure of a future to a specific `value`.

When this future fails, this `value` will complete the future returned by this method call.

When this future succeeds, the result will be propagated to the returned future.

##### Parameters:

Name | Type | Description
--- | --- | ---
`value` | CompositeFuture | the value that eventually completes the mapped future

Source:
  - vertx-js/composite_future.js, line 293

##### Returns:

the mapped future

Type
  Future

#### otherwiseEmpty() → {Future}

Map the failure of a future to `null`.

This is a convenience for `future.otherwise((T) null)`.

When this future fails, the `null` value will complete the future returned by this method call.

When this future succeeds, the result will be propagated to the returned future.

Source:
  - vertx-js/composite_future.js, line 318

##### Returns:

the mapped future

Type
  Future

#### recover(mapper) → {Future}

Handles a failure of this Future by returning the result of another Future. If the mapper fails, then the returned future will be failed with this failure.

##### Parameters:

Name | Type | Description
--- | --- | ---
`mapper` | todo | A function which takes the exception of a failure and returns a new future.

Source:
  - vertx-js/composite_future.js, line 272

##### Returns:

A recovered future

Type
  Future

#### result() → {CompositeFuture}

The result of the operation. This will be null if the operation failed.

Source:
  - vertx-js/composite_future.js, line 120

##### Returns:

the result or null if the operation failed.

Type
  CompositeFuture

#### resultAt(index) → {Object}

Returns the result of a wrapped future

##### Parameters:

Name | Type | Description
--- | --- | ---
`index` | number | the wrapped future index

Source:
  - vertx-js/composite_future.js, line 352

##### Returns:

Type
  Object

#### setHandler(handler) → {CompositeFuture}

##### Parameters:

Name | Type | Description
--- | --- | ---
`handler` | function |

Source:
  - vertx-js/composite_future.js, line 331

##### Returns:

Type
  CompositeFuture

#### size() → {number}

Source:
  - vertx-js/composite_future.js, line 365

##### Returns:

the number of wrapped future

Type
  number

#### succeeded(index) → {boolean}

Returns true if a wrapped future is succeeded

##### Parameters:

Name | Type | Description
--- | --- | ---
`index` | number | the wrapped future index

Source:
  - vertx-js/composite_future.js, line 150

##### Returns:

Type
  boolean

#### tryComplete(result) → {boolean}

Set the failure. Any handler will be called, if there is one, and the future will be marked as completed.

##### Parameters:

Name | Type | Description
--- | --- | ---
`result` | CompositeFuture | the result

Source:
  - vertx-js/composite_future.js, line 88

##### Returns:

false when the future is already completed

Type
  boolean

#### tryFail(failureMessage) → {boolean}

Try to set the failure. When it happens, any handler will be called, if there is one, and the future will be marked as completed.

##### Parameters:

Name | Type | Description
--- | --- | ---
`failureMessage` | string | the failure message

Source:
  - vertx-js/composite_future.js, line 104

##### Returns:

false when the future is already completed

Type
  boolean