com.thoughtworks.proxy.toys.multicast
Interface Multicast


public interface Multicast

Interface that is implemented by all multicasting proxies. Cast the proxy to access the proxied elements again or to call a method on them independent of the type of the proxy.

Since:
0.2
Author:
Jörg Schaible

Method Summary
 Object[] getTargetsInArray()
          Access the targets of the proxy in an array.
<T> T[]
getTargetsInArray(Class<T> type)
          Access the targets of the proxy in a typed array.
<T> T
multicastTargets(Class<T> type, String method, Object[] args)
          Multicast a matching method call, that is not available with the types implemented by the proxy.
 Object multicastTargets(Method method, Object[] args)
          Multicast a direct method call, that is not available with the types implemented by the proxy.
 

Method Detail

multicastTargets

<T> T multicastTargets(Class<T> type,
                       String method,
                       Object[] args)
                   throws NoSuchMethodException
Multicast a matching method call, that is not available with the types implemented by the proxy.

Use this possibility to operate on objects, that can typically not be proxied e.g. if the class type of the target object is final like it is for a lot of basic classes of java.lang. The result of the call follow the normal rules for multicast invocations.

Note that the implementation of this function must search the best fitting method. It is much more efficient to call the overloaded version of this function with the appropriate method object.

Parameters:
type - the type that has a method with the given name and matching arguments
method - the method name
args - the arguments of the invocation
Returns:
the result of the multicast
Throws:
NoSuchMethodException - if the type has no matching method
SecurityException - if the security manager prevents the method access by reflection
Since:
0.2

multicastTargets

Object multicastTargets(Method method,
                        Object[] args)
Multicast a direct method call, that is not available with the types implemented by the proxy.

Use this possibility to operate on objects, that can typically not be proxied e.g. if the class type of the target object is final like it is for a lot of basic classes of java.lang. The result of the call follow the normal rules for multicast invocations.

Parameters:
method - the method to call
args - the arguments of the invocation
Returns:
the result of the multicast
Since:
0.2

getTargetsInArray

<T> T[] getTargetsInArray(Class<T> type)
Access the targets of the proxy in a typed array.

Parameters:
type - the type of an array element
Returns:
the typed array of proxy targets
Since:
0.2

getTargetsInArray

Object[] getTargetsInArray()
Access the targets of the proxy in an array.

Returns:
the array of proxy targets
Since:
0.2


Copyright © 2005-2010 Codehaus. All Rights Reserved.