net.sf.asyncobjects.util.callbacks
Class CallableAdapter<T>

java.lang.Object
  extended by net.sf.asyncobjects.util.callbacks.CallableAdapter<T>
Type Parameters:
T - a value type
All Implemented Interfaces:
ExplicitSharing

public abstract class CallableAdapter<T>
extends Object
implements ExplicitSharing

This is an adapter for callable actions that allows to create ACallable instances using anonymous inner classes.

Author:
const

Nested Class Summary
 class CallableAdapter.InternalCallableAdapter
          An internal class that addapt Adapter calss to asynchronous interface.
 
Constructor Summary
CallableAdapter()
           
 
Method Summary
protected abstract  Promise<? extends T> call()
          Call the action
 ACallable<T> export()
           
static
<V> ACallable<V>
wrap(Callable<V> callable)
          Wrap Callable object into asynchronous object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CallableAdapter

public CallableAdapter()
Method Detail

export

public final ACallable<T> export()
Returns:
export as callable asynchronous object
See Also:
ACallable.call()

call

protected abstract Promise<? extends T> call()
                                      throws Throwable
Call the action

Returns:
a promise for value or null
Throws:
Throwable - if there is a problem with action execution

wrap

public static <V> ACallable<V> wrap(Callable<V> callable)
Wrap Callable object into asynchronous object

Type Parameters:
V - a value type
Parameters:
callable - a callable object
Returns:
async object that wraps it


Copyright 2002-2007 Constantine Plotnikov. All Rights Reserved.