com.amazonaws.services.simpleworkflow.flow.core

## クラス Promise<V>

- java.lang.Object
- - com.amazonaws.services.simpleworkflow.flow.core.Promise<V>

- 型パラメータ:
    `V` - The result type returned by this Promise's get method. Use `Void` to represent Promise that indicates completion of operation that doesn't return a value.
  直系の既知のサブクラス:
    AndPromise, Functor, OrPromise, Settable

      public abstract class Promise<V>
      extends java.lang.Object

  Promise is a future like object that is used as a placeholder for a result of an asynchronous API. Java Future is a synchronization construct that is used to block a thread that called get() method if result is not available yet. Promise differs from it as it cannot be used for blocking. A call to its get() method throws IllegalStateException if result is not available yet. The correct way to ensure that Promise is ready is to access it from a method that is annotated as @Asynchronous and have the given Promise as one its arguments or from `Task.doExecute()` method assuming that promise was passed to the Task as a constructor parameter.

  Promise is not linked to error handling like Future is. In case of exceptions they are propagated to the `TryCatchFinally.doCatch(Throwable)` method of the `TryCatchFinally` that owns the asynchronous task that failed. See `TryCatchFinally` for more info on the error handling.

  For promises that don't need a value and just used to ensure correct ordering of asynchronous operations the common pattern to use `Void` as a generic type.

- - ### コンストラクタの概要

    コンストラクタ
    コンストラクタと説明
    `Promise()`

  - ### メソッドの概要

    メソッド
    修飾子とタイプ | メソッドと説明
    --- | ---
    `protected abstract void` | `addCallback(java.lang.Runnable callback)` Compliant implementation should notify callbacks after promise is set to ready state.
    `static <T> Promise<T>` | `asPromise(T value)` Convenience method for creating a Promise object which is in ready state and returns the passed in value when get() is called.
    `abstract V` | `get()`
    `java.lang.String` | `getDescription()`
    `abstract boolean` | `isReady()`
    `protected abstract void` | `removeCallback(java.lang.Runnable callback)`
    `static Promise<java.lang.Void>` | `Void()` This is a factory method to create a Promise object in ready state.

    - ### クラスから継承されたメソッド java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### コンストラクタの詳細

    - #### Promise

          public Promise()

  - ### メソッドの詳細

    - #### get

          public abstract V get()

      戻り値:
        result of your asynchronous computation
      例外:
        `java.lang.IllegalStateException` - if result of your asynchronous computation is not available yet

    - #### isReady

          public abstract boolean isReady()

      戻り値:
        `true` if the result of your asynchronous computation is available

    - #### getDescription

          public java.lang.String getDescription()

      戻り値:
        human friendly description on what this promise represents. Emitted for example as part of `AsyncScope.getAsynchronousThreadDumpAsString()`

    - #### addCallback

          protected abstract void addCallback(java.lang.Runnable callback)

      Compliant implementation should notify callbacks after promise is set to ready state.
      パラメータ:
        `callback` - callback to notify

    - #### removeCallback

          protected abstract void removeCallback(java.lang.Runnable callback)

    - #### asPromise

          public static <T> Promise<T> asPromise(T value)

      Convenience method for creating a Promise object which is in ready state and returns the passed in value when get() is called.

      The same as `new `Settable`(value)`

      型パラメータ:
        `T` - Type of value
      パラメータ:
        `value` - Object to return when get() is called
      戻り値:
        An instance of Promise wrapper object

    - #### Void

          public static Promise<java.lang.Void> Void()

      This is a factory method to create a Promise object in ready state.
      戻り値:
        An instance of Promise object with no value.