public class DefaultInvocationHandler extends Object implements DefaultInterfaceMethodInvocationHandler
InvocationHandler
implementation.
See invoke(Object,Method,Object[])
.Constructor and Description |
---|
DefaultInvocationHandler() |
Modifier and Type | Method and Description |
---|---|
protected List<Class<?>> |
getImplementedInterfacesOf(Class<?> type,
Class<?>... types)
Method available to subclass implementations to get the implemented
interfaces of the argument
types . |
Class<?> |
getProxyClass(Class<?>... interfaces)
|
Object |
invoke(Object proxy,
Method method,
Object[] argv)
This method assumes
method.isDefault() and
will invoke Method directly. |
Object |
newProxyInstance(Class<?>... interfaces)
|
public DefaultInvocationHandler()
protected List<Class<?>> getImplementedInterfacesOf(Class<?> type, Class<?>... types)
types
. The default
implementation caches the results.public Class<?> getProxyClass(Class<?>... interfaces) throws IllegalArgumentException
interfaces
- The interface Class
es the
Proxy
Class
will implement.Proxy
.IllegalArgumentException
public Object invoke(Object proxy, Method method, Object[] argv) throws Throwable
method.isDefault()
and
will invoke Method
directly.
If the method.isDefault()
, that
Method
will be invoked directly. If the Method
is
declared in Object
, it is applied to this
InvocationHandler
. Otherwise, the call will be dispatched to
a declared Method
on this
InvocationHandler
with the same name and compatible parameter types (forcing access if
necessary).invoke
in interface DefaultInterfaceMethodInvocationHandler
invoke
in interface InvocationHandler
Exception
- If no compatible Method
is found or
the Method
cannot be invoked.Throwable
public Object newProxyInstance(Class<?>... interfaces) throws IllegalArgumentException
Proxy.newProxyInstance(ClassLoader,Class[],InvocationHandler)
.
Default implementation invokes getProxyClass(Class...)
.interfaces
- The interface Class
es the
Proxy
Class
will implement.Proxy
.IllegalArgumentException
Copyright © 2015–2020 Allen D. Ball. All rights reserved.