01: /*
02: * This software is released under a licence similar to the Apache Software Licence.
03: * See org.logicalcobwebs.proxool.package.html for details.
04: * The latest version is available at http://proxool.sourceforge.net
05: */
06: package org.logicalcobwebs.cglib;
07:
08: import org.logicalcobwebs.cglib.proxy.MethodInterceptor;
09: import org.logicalcobwebs.cglib.proxy.MethodProxy;
10:
11: import java.lang.reflect.Method;
12:
13: /**
14: * See {@link EnhancerTest}
15: * @version $Revision: 1.1 $, $Date: 2004/06/02 20:54:57 $
16: * @author billhorsman
17: * @author $Author: billhorsman $ (current maintainer)
18: */
19: public class MyProxy implements MethodInterceptor {
20:
21: private MyConcreteClass myConcreteClass;
22:
23: public MyProxy(MyConcreteClass myConcreteClass) {
24: this .myConcreteClass = myConcreteClass;
25: }
26:
27: public Object intercept(Object obj, Method method, Object[] args,
28: MethodProxy proxy) throws Throwable {
29: if (method.getName().equals("foo")) {
30: return "proxiedFoo";
31: } else {
32: return method.invoke(myConcreteClass, args);
33: }
34: }
35:
36: }
37: /*
38: Revision history:
39: $Log: MyProxy.java,v $
40: Revision 1.1 2004/06/02 20:54:57 billhorsman
41: Learning test class for Enhancer. It fails (or would if the assert was uncommented). Left in for knowledge.
42:
43: */
|