01: /*
02: * Created on 18.05.2005 from Linke
03: *
04: */
05: package net.sf.crispy;
06:
07: import java.lang.reflect.Method;
08:
09: import net.sf.crispy.proxy.DynamicProxy;
10:
11: /**
12: * Structure with information about the method-invocation, how method and args.
13: *
14: * @author Linke
15: *
16: */
17: public final class InterceptorContext {
18:
19: private DynamicProxy dynamicProxy = null;
20: private Method method = null;
21: private Object[] args = null;
22: private Object elseObject = null;
23: private Object result = null;
24: private boolean interruptInvocation = false;
25:
26: public InterceptorContext(DynamicProxy pvDynamicProxy,
27: Method pvMethod, Object pvArgs[]) {
28: setDynamicProxy(pvDynamicProxy);
29: setMethod(pvMethod);
30: setArgs(pvArgs);
31: }
32:
33: public InterceptorContext(DynamicProxy pvDynamicProxy,
34: Method pvMethod, Object pvArgs[], Object pvElseObject) {
35: setDynamicProxy(pvDynamicProxy);
36: setMethod(pvMethod);
37: setArgs(pvArgs);
38: setElseObject(pvElseObject);
39: }
40:
41: public void setInterruptInvocation(boolean pvInterruptInvocation) {
42: interruptInvocation = pvInterruptInvocation;
43: }
44:
45: public boolean getInterruptInvocation() {
46: return interruptInvocation;
47: }
48:
49: public Object[] getArgs() {
50: return args;
51: }
52:
53: public void setArgs(Object[] pvArgs) {
54: args = pvArgs;
55: }
56:
57: public DynamicProxy getDynamicProxy() {
58: return dynamicProxy;
59: }
60:
61: public void setDynamicProxy(DynamicProxy pvDynamicProxy) {
62: dynamicProxy = pvDynamicProxy;
63: }
64:
65: public Object getElseObject() {
66: return elseObject;
67: }
68:
69: public void setElseObject(Object pvElseObject) {
70: elseObject = pvElseObject;
71: }
72:
73: public Method getMethod() {
74: return method;
75: }
76:
77: public void setMethod(Method pvMethod) {
78: method = pvMethod;
79: }
80:
81: public void setResult(Object pvResult) {
82: result = pvResult;
83: }
84:
85: public Object getResult() {
86: return result;
87: }
88:
89: /**
90: * @see java.lang.Object#toString()
91: */
92: public String toString() {
93: return "Proxy: " + getDynamicProxy() + " - Method: "
94: + getMethod() + " - Args: " + getArgs() + " - Result: "
95: + getResult();
96: }
97: }
|