Interface CompositeProxy.InvokeTunnel
- Enclosing class:
CompositeProxy
public static interface CompositeProxy.InvokeTunnel
Invocation tunnel. Must be used when building a composite proxy from objects
that implement package-private interfaces to prevent
IllegalAccessException
exceptions being thrown by Proxy
instances. Must be implemented by classes from packages with package-private
interfaces used with CompositeProxy
class.
Assumed implementation:
package org.foo;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import jdk.jpackage.internal.util.CompositeProxy;
final class CompositeProxyTunnel implements CompositeProxy.InvokeTunnel {
@Override
public Object invoke(Object obj, Method method, Object[] args) throws Throwable {
return method.invoke(obj, args);
}
@Override
public Object invokeDefault(Object proxy, Method method, Object[] args) throws Throwable {
return InvocationHandler.invokeDefault(proxy, method, args);
}
static final CompositeProxyTunnel INSTANCE = new CompositeProxyTunnel();
}
-
Method Summary
Modifier and TypeMethodDescriptionProcesses a method invocation on an object of composite proxy and returns the result.invokeDefault
(Object proxy, Method method, Object[] args) Processes a default interface method invocation on a composite proxy and returns the result.
-
Method Details
-
invoke
Processes a method invocation on an object of composite proxy and returns the result.- Parameters:
obj
- the object on which to invoke the methodmethod
- the method to invokeargs
- the arguments to use in the method call- Returns:
- the result of the method call
- Throws:
Throwable
- if the method throws- Implementation Note:
- Implementation should call the given method on the given object with the given arguments and return the result of the call.
-
invokeDefault
Processes a default interface method invocation on a composite proxy and returns the result.- Parameters:
proxy
- theproxy
parameter forInvocationHandler.invokeDefault(Object, Method, Object...)
callmethod
- themethod
parameter forInvocationHandler.invokeDefault(Object, Method, Object...)
callargs
- theargs
parameter forInvocationHandler.invokeDefault(Object, Method, Object...)
call- Returns:
- the result of the
InvocationHandler.invokeDefault(Object, Method, Object...)
call - Throws:
Throwable
- if theInvocationHandler.invokeDefault(Object, Method, Object...)
call throws- Implementation Note:
- Implementation should call
InvocationHandler.invokeDefault(Object, Method, Object...)
method on the given proxy object with the given arguments and return the result of the call.
-