|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.starlink.util.MultiplexInvocationHandler<T>
public class MultiplexInvocationHandler<T>
Used to generate a proxy instance which implements a given interface and delegates its calls to each of a given list of target implementations. The content of the list of targets may be changed during the lifetime of this object, but it's not a good idea to do it while a method is being invoked.
Constructor Summary | |
---|---|
MultiplexInvocationHandler(T[] targets)
Constructor. |
Method Summary | |
---|---|
T |
createMultiplexer(Class<T> clazz)
Returns a new proxy instance which implements the given interface type, and which uses this handler to execute its methods. |
T[] |
getTargets()
Returns the list of delegate implementations. |
Object |
invoke(Object proxy,
Method method,
Object[] args)
Invokes a method by invoking the same method on each of this handler's target instances. |
void |
setTargets(T[] targets)
Sets the list of delegate implementations. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MultiplexInvocationHandler(T[] targets)
targets
- target instancesMethod Detail |
---|
public void setTargets(T[] targets)
public T[] getTargets()
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
invoke
in interface InvocationHandler
Throwable
public T createMultiplexer(Class<T> clazz)
clazz
- interface the return value will implement
|
Copyright © 2004 CLRC: Central Laboratory of the Research Councils. All rights reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |