Interface AResolver<T>

Type Parameters:
T - A resolved value type
All Superinterfaces:
All Known Implementing Classes:
Promise.InternalPromiseResolverImpl, When.InternalArgumentListener, When.InternalBodyPromiseResolver, When.InternalFinallyListenerAfterFault, When.InternalFinallyListenerAfterSuccess, When.InternalResultPromiseResolver

public interface AResolver<T>
extends AsyncObject

This is a fundamental interface that is used to return values from operation. However it is rarely implemented directly. Usually code uses either Promise (that represent process returning the value) or When that represent the process of waiting for value.

Method Summary
 void resolve(T value)
          Resolve promise with value which is a result of successful execution of the operation.
 void smash(Throwable ex)
          Smash the promise with exception.
Methods inherited from interface net.sf.asyncobjects.AsyncObject
dereference, isImmediate

Method Detail


void smash(Throwable ex)
Smash the promise with exception. This method is used to notity promise that operation cannot be fulfilled due to the specified reason.

ex - an exeception that describes a reason for failure. Note that ex must not be null. Smashing with null is normally treated as smashing with a NullPointerException.


void resolve(T value)
Resolve promise with value which is a result of successful execution of the operation.

value - a value to return to promise. The value must not be a promise. If promise is provided to resolver, resolvers implemented by Promise and When treat it as if the resolver was smashed with IllegalArgumentException.

Copyright 2002-2007 Constantine Plotnikov. All Rights Reserved.