Package ball.lang.reflect
Class FacadeProxyInvocationHandler
- java.lang.Object
-
- ball.lang.reflect.DefaultInvocationHandler
-
- ball.lang.reflect.FacadeProxyInvocationHandler
-
- All Implemented Interfaces:
DefaultInterfaceMethodInvocationHandler
,InvocationHandler
- Direct Known Subclasses:
FluentNode.InvocationHandler
public abstract class FacadeProxyInvocationHandler extends DefaultInvocationHandler
InvocationHandler
abstract base class to "extend" concrete implementationClass
es by adding "facade" interfaces. SeegetProxyClassFor(Object)
.- Author:
- Allen D. Ball
-
-
Constructor Summary
Constructors Constructor Description FacadeProxyInvocationHandler()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Object
enhance(Object in)
Method to return an extendedProxy
implementing "facade" interfaces forin
ifgetProxyClassFor(Object)
returns non-null
.protected abstract Class<?>
getProxyClassFor(Object object)
Object
invoke(Object proxy, Method method, Object[] argv)
If themethod.isDefault()
, thatMethod
will be invoked directly.-
Methods inherited from class ball.lang.reflect.DefaultInvocationHandler
getImplementedInterfacesOf, getProxyClass, newProxyInstance
-
-
-
-
Constructor Detail
-
FacadeProxyInvocationHandler
public FacadeProxyInvocationHandler()
-
-
Method Detail
-
enhance
public Object enhance(Object in)
Method to return an extendedProxy
implementing "facade" interfaces forin
ifgetProxyClassFor(Object)
returns non-null
.- Parameters:
in
- TheObject
to extend.- Returns:
- A
Proxy
ifgetProxyClassFor(Object)
returns non-null
;in
otherwise.
-
getProxyClassFor
protected abstract Class<?> getProxyClassFor(Object object)
-
invoke
public Object invoke(Object proxy, Method method, Object[] argv) throws Throwable
Description copied from class:DefaultInvocationHandler
If themethod.isDefault()
, thatMethod
will be invoked directly. If theMethod
is declared inObject
, it is applied tothis
InvocationHandler
. Otherwise, the call will be dispatched to a declaredMethod
onthis
InvocationHandler
with the same name and compatible parameter types (forcing access if necessary).- Specified by:
invoke
in interfaceDefaultInterfaceMethodInvocationHandler
- Specified by:
invoke
in interfaceInvocationHandler
- Overrides:
invoke
in classDefaultInvocationHandler
- Parameters:
proxy
- The proxy instance.method
- TheMethod
.argv
- The argument array.- Returns:
- The value to return from the
Method
invocation. - Throws:
Throwable
-
-