private final class PromiseImpl.ResolveWith extends java.lang.Object implements Success<T,java.lang.Void>, Failure
PromiseImpl.resolveWith(Promise)
method.Modifier and Type | Field and Description |
---|---|
private PromiseImpl<java.lang.Void> |
chained |
Constructor and Description |
---|
ResolveWith(PromiseImpl<java.lang.Void> chained) |
Modifier and Type | Method and Description |
---|---|
Promise<java.lang.Void> |
call(Promise<T> with)
Success callback for a Promise.
|
void |
fail(Promise<?> with)
Failure callback for a Promise.
|
private final PromiseImpl<java.lang.Void> chained
ResolveWith(PromiseImpl<java.lang.Void> chained)
public Promise<java.lang.Void> call(Promise<T> with) throws java.lang.Exception
Success
This method is called if the Promise with which it is registered resolves successfully.
In the remainder of this description we will refer to the Promise
returned by this method as the returned Promise and the Promise returned
by Promise.then(Success)
when this Success callback was
registered as the chained Promise.
If the returned Promise is null
then the chained Promise must
resolve immediately with a successful value of null
. If the
returned Promise is not null
then the chained Promise must be
resolved when the returned Promise is resolved.
call
in interface Success<T,java.lang.Void>
with
- The successfully resolved Promise
.null
if the chained Promise is to be resolved immediately
with the value null
.java.lang.Exception
- The chained Promise must be failed with the thrown
exception.public void fail(Promise<?> with) throws java.lang.Exception
Failure
This method is called if the Promise with which it is registered resolves with a failure.
In the remainder of this description we will refer to the Promise
returned by Promise.then(Success, Failure)
when this Failure
callback was registered as the chained Promise.
If this methods completes normally, the chained Promise must be failed with the same exception which failed the resolved Promise. If this method throws an exception, the chained Promise must be failed with the thrown exception.