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 Classes the
Proxy Class will implement.Proxy.IllegalArgumentExceptionpublic 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 DefaultInterfaceMethodInvocationHandlerinvoke in interface InvocationHandlerException - If no compatible Method is found or
the Method cannot be invoked.Throwablepublic Object newProxyInstance(Class<?>... interfaces) throws IllegalArgumentException
Proxy.newProxyInstance(ClassLoader,Class[],InvocationHandler).
Default implementation invokes getProxyClass(Class...).interfaces - The interface Classes the
Proxy Class will implement.Proxy.IllegalArgumentExceptionCopyright © 2015–2020 Allen D. Ball. All rights reserved.