com.thoughtworks.proxy.toys.multicast
Class Multicasting

java.lang.Object
  extended by com.thoughtworks.proxy.toys.multicast.Multicasting

public class Multicasting
extends Object

Toy factory to create proxies delegating a call to multiple objects and managing the individual results.

Since:
0.1
Author:
Dan North, Aslak Hellesøy, Jörg Schaible
See Also:
com.thoughtworks.proxy.toys.multicast

Method Summary
static Object object(Class[] types, ProxyFactory proxyFactory, Object[] targets)
          Generate a proxy for the specified types calling the methods on the given targets.
static Object object(Class type, ProxyFactory proxyFactory, Object[] targets)
          Generate a proxy for the specified type calling the methods on the given targets.
static Object object(Object[] targets)
          Generate a proxy that is calling the methods on the given targets using a StandardProxyFactory.
static Object object(ProxyFactory proxyFactory, Object[] targets)
          Generate a proxy that is calling the methods on the given targets.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

object

public static Object object(Class[] types,
                            ProxyFactory proxyFactory,
                            Object[] targets)
Generate a proxy for the specified types calling the methods on the given targets.

Note, that the method will only return a proxy if necessary. If there is only one target instance and this instance implements all of the specified types, then there is no point in creating a proxy.

Parameters:
types - the types that are implemented by the proxy
proxyFactory - the ProxyFactory to use
targets - the target objects
Returns:
the new proxy implementing Multicast or the only target
Since:
0.1

object

public static Object object(Class type,
                            ProxyFactory proxyFactory,
                            Object[] targets)
Generate a proxy for the specified type calling the methods on the given targets.

Note, that the method will only return a proxy if necessary. If there is only one target instance and this instance implements the specified type, then there is no point in creating a proxy.

Parameters:
type - the type that is implemented by the proxy
proxyFactory - the ProxyFactory to use
targets - the target objects
Returns:
the new proxy implementing Multicast or the only target
Since:
0.1

object

public static Object object(ProxyFactory proxyFactory,
                            Object[] targets)
Generate a proxy that is calling the methods on the given targets.

The type of the proxy is a combination of all interfaces implemented by all targets and their most common super class (if supported by the ProxyFactory). Note, that the method will only return a proxy if necessary. If there is only one target instance, then there is no point in creating a proxy.

Parameters:
proxyFactory - the ProxyFactory to use
targets - the target objects
Returns:
the new proxy implementing Multicast or the only target
Since:
0.1

object

public static Object object(Object[] targets)
Generate a proxy that is calling the methods on the given targets using a StandardProxyFactory.

The type of the proxy is a combination of all interfaces implemented by all targets. Note, that the method will only return a proxy if necessary. If there is only one target instance, then there is no point in creating a proxy.

Parameters:
targets - the target objects
Returns:
the new proxy implementing Multicast or the only target
Since:
0.1