com.thoughtworks.proxy.toys.dispatch
Class DispatchingInvoker

java.lang.Object
  extended by com.thoughtworks.proxy.toys.dispatch.DispatchingInvoker
All Implemented Interfaces:
Invoker, Serializable

public class DispatchingInvoker
extends Object
implements Invoker

Invoker that dispatches all invocations to different objects according the membership of the method.

Since:
0.2
Author:
Jörg Schaible after idea by Rickard Öberg
See Also:
Serialized Form

Constructor Summary
protected DispatchingInvoker()
          Constructor used by pure reflection serialization.
  DispatchingInvoker(ProxyFactory proxyFactory, Class<?>[] types, ObjectReference<Object>[] delegateReferences)
          Construct a DispatchingInvoker.
 
Method Summary
 Object invoke(Object proxy, Method method, Object[] args)
          Invocation of a method of the proxied object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DispatchingInvoker

public DispatchingInvoker(ProxyFactory proxyFactory,
                          Class<?>[] types,
                          ObjectReference<Object>[] delegateReferences)
Construct a DispatchingInvoker.

Parameters:
proxyFactory - the ProxyFactory to use
types - the types of the generated proxy
delegateReferences - the ObjectReferences for the delegates
Since:
0.2

DispatchingInvoker

protected DispatchingInvoker()
Constructor used by pure reflection serialization.

Since:
0.2
Method Detail

invoke

public Object invoke(Object proxy,
                     Method method,
                     Object[] args)
              throws Throwable
Description copied from interface: Invoker
Invocation of a method of the proxied object.

Specified by:
invoke in interface Invoker
Parameters:
proxy - the proxy instance.
method - the method to invoke.
args - the arguments of the method.
Returns:
the result of the invoked method.
Throws:
Throwable - if the invoked method has thrown.


Copyright © 2005-2010 Codehaus. All Rights Reserved.