View Javadoc

1   /*
2    * Created on 18.05.2005 from Linke
3    *
4    */
5   package net.sf.crispy;
6   
7   import java.lang.reflect.Method;
8   
9   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  	
27  	public InterceptorContext (DynamicProxy pvDynamicProxy, Method pvMethod, Object pvArgs[]) {
28  		setDynamicProxy(pvDynamicProxy);
29  		setMethod(pvMethod);
30  		setArgs(pvArgs);
31  	}
32  	public InterceptorContext (DynamicProxy pvDynamicProxy, Method pvMethod, Object pvArgs[], Object pvElseObject) {
33  		setDynamicProxy(pvDynamicProxy);
34  		setMethod(pvMethod);
35  		setArgs(pvArgs);
36  		setElseObject(pvElseObject);
37  	}
38  
39  
40  	public void setInterruptInvocation(boolean pvInterruptInvocation) { interruptInvocation = pvInterruptInvocation; }
41  	public boolean getInterruptInvocation() { return interruptInvocation; }
42  	
43  	public Object[] getArgs() { return args; }
44  	public void setArgs(Object[] pvArgs) { args = pvArgs; }
45  	
46  	public DynamicProxy getDynamicProxy() { return dynamicProxy; }
47  	public void setDynamicProxy(DynamicProxy pvDynamicProxy) { dynamicProxy = pvDynamicProxy; }
48  	
49  	public Object getElseObject() { return elseObject; }
50  	public void setElseObject(Object pvElseObject) { elseObject = pvElseObject; }
51  	
52  	public Method getMethod() { return method; }
53  	public void setMethod(Method pvMethod) { method = pvMethod; }
54  		
55  	public void setResult(Object pvResult) { result = pvResult; }
56  	public Object getResult() { return result; }
57  
58  	/**
59  	 * @see java.lang.Object#toString()
60  	 */
61  	public String toString() {
62  		return "Proxy: " + getDynamicProxy() + " - Method: " + getMethod() + " - Args: " + getArgs() + " - Result: " + getResult();
63  	}
64  }