/** * Resolve this Promise with the specified Promise. * <p> * If the specified Promise is successfully resolved, this Promise is * resolved with the value of the specified Promise. If the specified * Promise is resolved with a failure, this Promise is resolved with the * failure of the specified Promise. * * @param with A Promise whose value or failure must be used to resolve this * Promise. Must not be {@code null}. * @return A Promise that is resolved only when this Promise is resolved by * the specified Promise. The returned Promise must be successfully * resolved with the value {@code null}, if this Promise was * resolved by the specified Promise. The returned Promise must be * resolved with a failure of {@link IllegalStateException}, if this * Promise was already resolved when the specified Promise was * resolved. */ Promise<Void> resolveWith(Promise< ? extends T> with) { DeferredPromiseImpl<Void> chained = deferred(); with.onResolve(chained.new ResolveWith<>(with, this)); return chained.orDone(); }
/** * Resolve this Promise with the specified Promise. * <p> * If the specified Promise is successfully resolved, this Promise is * resolved with the value of the specified Promise. If the specified * Promise is resolved with a failure, this Promise is resolved with the * failure of the specified Promise. * * @param with A Promise whose value or failure must be used to resolve this * Promise. Must not be {@code null}. * @return A Promise that is resolved only when this Promise is resolved by * the specified Promise. The returned Promise must be successfully * resolved with the value {@code null}, if this Promise was * resolved by the specified Promise. The returned Promise must be * resolved with a failure of {@link IllegalStateException}, if this * Promise was already resolved when the specified Promise was * resolved. */ Promise<Void> resolveWith(Promise< ? extends T> with) { DeferredPromiseImpl<Void> chained = deferred(); chain(with, chained.new ResolveWith<>(with, this)); return chained.orDone(); }
/** * Resolve this Promise with the specified Promise. * <p> * If the specified Promise is successfully resolved, this Promise is * resolved with the value of the specified Promise. If the specified * Promise is resolved with a failure, this Promise is resolved with the * failure of the specified Promise. * * @param with A Promise whose value or failure must be used to resolve this * Promise. Must not be {@code null}. * @return A Promise that is resolved only when this Promise is resolved by * the specified Promise. The returned Promise must be successfully * resolved with the value {@code null}, if this Promise was * resolved by the specified Promise. The returned Promise must be * resolved with a failure of {@link IllegalStateException}, if this * Promise was already resolved when the specified Promise was * resolved. */ Promise<Void> resolveWith(Promise< ? extends T> with) { DeferredPromiseImpl<Void> chained = deferred(); with.onResolve(chained.new ResolveWith<>(with, this)); return chained.orDone(); }
/** * Resolve this Promise with the specified Promise. * <p> * If the specified Promise is successfully resolved, this Promise is * resolved with the value of the specified Promise. If the specified * Promise is resolved with a failure, this Promise is resolved with the * failure of the specified Promise. * * @param with A Promise whose value or failure must be used to resolve this * Promise. Must not be {@code null}. * @return A Promise that is resolved only when this Promise is resolved by * the specified Promise. The returned Promise must be successfully * resolved with the value {@code null}, if this Promise was * resolved by the specified Promise. The returned Promise must be * resolved with a failure of {@link IllegalStateException}, if this * Promise was already resolved when the specified Promise was * resolved. */ Promise<Void> resolveWith(Promise< ? extends T> with) { DeferredPromiseImpl<Void> chained = deferred(); chain(with, chained.new ResolveWith<>(with, this)); return chained.orDone(); }
/** * Resolve this Promise with the specified Promise. * <p> * If the specified Promise is successfully resolved, this Promise is * resolved with the value of the specified Promise. If the specified * Promise is resolved with a failure, this Promise is resolved with the * failure of the specified Promise. * * @param with A Promise whose value or failure must be used to resolve this * Promise. Must not be {@code null}. * @return A Promise that is resolved only when this Promise is resolved by * the specified Promise. The returned Promise must be successfully * resolved with the value {@code null}, if this Promise was * resolved by the specified Promise. The returned Promise must be * resolved with a failure of {@link IllegalStateException}, if this * Promise was already resolved when the specified Promise was * resolved. */ Promise<Void> resolveWith(Promise< ? extends T> with) { DeferredPromiseImpl<Void> chained = deferred(); with.onResolve(chained.new ResolveWith<>(with, this)); return chained.orDone(); }
/** * Resolve this Promise with the specified Promise. * <p> * If the specified Promise is successfully resolved, this Promise is * resolved with the value of the specified Promise. If the specified * Promise is resolved with a failure, this Promise is resolved with the * failure of the specified Promise. * * @param with A Promise whose value or failure must be used to resolve this * Promise. Must not be {@code null}. * @return A Promise that is resolved only when this Promise is resolved by * the specified Promise. The returned Promise must be successfully * resolved with the value {@code null}, if this Promise was * resolved by the specified Promise. The returned Promise must be * resolved with a failure of {@link IllegalStateException}, if this * Promise was already resolved when the specified Promise was * resolved. */ Promise<Void> resolveWith(Promise< ? extends T> with) { DeferredPromiseImpl<Void> chained = deferred(); with.onResolve(chained.new ResolveWith<>(with, this)); return chained.orDone(); }
/** * Resolve this Promise with the specified Promise. * <p> * If the specified Promise is successfully resolved, this Promise is * resolved with the value of the specified Promise. If the specified * Promise is resolved with a failure, this Promise is resolved with the * failure of the specified Promise. * * @param with A Promise whose value or failure must be used to resolve this * Promise. Must not be {@code null}. * @return A Promise that is resolved only when this Promise is resolved by * the specified Promise. The returned Promise must be successfully * resolved with the value {@code null}, if this Promise was * resolved by the specified Promise. The returned Promise must be * resolved with a failure of {@link IllegalStateException}, if this * Promise was already resolved when the specified Promise was * resolved. */ Promise<Void> resolveWith(Promise< ? extends T> with) { DeferredPromiseImpl<Void> chained = deferred(); with.onResolve(chained.new ResolveWith<>(with, this)); return chained.orDone(); }