View Javadoc

1   package org.neo.swarm.core.aop.silc.comp;
2   
3   import java.lang.reflect.AccessibleObject;
4   import java.lang.reflect.Method;
5   
6   
7   /***
8    *
9    * @author damiang
10   */
11  public class StubInvocation implements Invocation {
12      private String key;
13      private Class targetInterface;
14  	private String methodName;
15  	private Object[] args;
16  
17  	public void setTarget(Object o) {
18  	}
19  
20  	public Object getKey() {
21  		return key;
22  	}
23  
24      public StubInvocation() {}
25  
26  	public StubInvocation(String key, Class targetInterface, String methodName, Object [] args) {
27          this.key = key;
28          this.targetInterface = targetInterface;
29  		this.methodName = methodName;
30  		this.args = args;
31  	}
32  
33  	public Object proceed() throws Throwable {
34  		return null;
35  	}
36  	
37  	public void setMethod(Method method) {
38  		
39  	}
40  
41  	public Method getMethod() {
42  		try {
43  			return targetInterface.getMethod(methodName, getParamTypes());
44  		} catch (NoSuchMethodException e) {
45  			throw new RuntimeException(e);
46  		}
47  	}
48  
49  	private Class[] getParamTypes() {
50  		if (args == null) {
51  			return null;
52  		}
53  		Class [] types = new Class [args.length];
54  		for (int i = 0; i < args.length; i++) {
55  			types[i] = args[i].getClass();
56  		}
57  		return types;
58  	}
59  
60  
61  	public Object[] getArguments() {
62  		return args;
63  	}
64  	
65  	public void setArguments(Object[] args) {
66  		this.args = new Object[args.length];
67  		System.arraycopy(args, 0, this.args, 0, args.length);
68  	}
69  	
70  	public Object getThis() {
71  		return null;
72  	}
73  	
74  	public AccessibleObject getStaticPart() {
75  		return null;
76  	}
77  }