Class MyInvocationHandler
java.lang.Object
info.ejava.examples.svc.aop.items.dynamicproxies.MyInvocationHandler
- All Implemented Interfaces:
InvocationHandler
This is an example Dynamic Proxy. The Proxy class implements the supplied
interfaces and delegates calls to the invoke() method within this class.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThis method will get called for each method call to the proxy.static Object
newInstance
(Object target) A convenience method to build a Dynamic Proxy for the interfaces of a target object of an unknown type.
-
Field Details
-
target
-
-
Constructor Details
-
MyInvocationHandler
public MyInvocationHandler()
-
-
Method Details
-
newInstance
A convenience method to build a Dynamic Proxy for the interfaces of a target object of an unknown type.- Parameters:
target
- object to proxy- Returns:
- the proxy wrapping the target
-
invoke
This method will get called for each method call to the proxy. The method will simply log when called, invoke the target method, and log when complete. A real handler might do things like check security accesses, begin/terminate a database transaction, etc.- Specified by:
invoke
in interfaceInvocationHandler
- Throws:
Throwable
-