com.thoughtworks.proxy.toys.future
Class Future<T>

java.lang.Object
  extended by com.thoughtworks.proxy.toys.future.Future<T>

public class Future<T>
extends Object

Factory for proxy instances that run any method call concurrently and return the method result later. Any method call for the proxied object will be called asynchronously. However, the call itself will return immediately with another proxy for the result object. This is a hot swappable proxy that contains a null object until the asynchronously called method returns. Then the result proxy is hot swapped with the real result of the method.

Since:
1.0
Author:
Aslak Hellesøy, Paul Hammant

Nested Class Summary
static class Future.FutureBuild<T>
           
static class Future.FutureWith<T>
           
 
Method Summary
static
<T> Future.FutureWith<T>
proxy(Class<T> primaryType)
          Creates a proxy instance for asynchronous calls on a type.
static
<T> Future.FutureWith<T>
proxy(Class<T> primaryType, Class<?>... types)
          Creates a proxy instance for asynchronous calls on a type.
static
<T> Future.FutureBuild<T>
proxy(T target)
          Creates a proxy instance for asynchronous calls on an object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

proxy

public static <T> Future.FutureWith<T> proxy(Class<T> primaryType)
Creates a proxy instance for asynchronous calls on a type.

Parameters:
primaryType - the type of the created proxy.
Returns:
the proxy of the specified type.
Since:
1.0

proxy

public static <T> Future.FutureWith<T> proxy(Class<T> primaryType,
                                             Class<?>... types)
Creates a proxy instance for asynchronous calls on a type.

Parameters:
primaryType - the main type of the created proxy.
types - the other types of the created proxy.
Returns:
the proxy of the specified types
Since:
1.0

proxy

public static <T> Future.FutureBuild<T> proxy(T target)
Creates a proxy instance for asynchronous calls on an object.

Parameters:
target - the proxied object.
Returns:
the proxy.
Since:
1.0


Copyright © 2005-2010 Codehaus. All Rights Reserved.