java.lang.Object
com.chaoswg.xtc4y.proxy.InvocationStack
- All Implemented Interfaces:
- java.lang.reflect.InvocationHandler
- public class InvocationStack
- extends java.lang.Object
- implements java.lang.reflect.InvocationHandler
Invocation stack, used to trace calls on a class
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
stack
private java.util.Stack stack
proxy
private java.lang.Object proxy
targetObject
private java.lang.Object targetObject
targetClass
private java.lang.Class targetClass
returnValues
private java.util.HashMap returnValues
InvocationStack
public InvocationStack(java.lang.Class target)
- Creates a new invocation stack and a proxy of a class
if methods are invoked on this proxy, they are traced and
default values are returned.
InvocationStack
public InvocationStack(java.lang.Object target)
- Creates a new invocationstack and a proxy of the given object.
if methods are invoked in the proxy, they are traced and the
invocations are redirected to the target object
getProxyObject
public java.lang.Object getProxyObject()
popStack
public MethodContainer popStack()
peekStack
public MethodContainer peekStack()
emptyStack
public void emptyStack()
- Empty stack
getMethod
public java.lang.reflect.Method getMethod(java.lang.String name)
getMethod
public java.lang.reflect.Method getMethod(java.lang.String name,
java.lang.Class[] params)
setReturnValue
public void setReturnValue(java.lang.reflect.Method method,
java.lang.Object value)
- set a return value for a specific method
removeReturnValue
public void removeReturnValue(java.lang.reflect.Method method)
- Remove a previously defined return value for a method
invoke
public java.lang.Object invoke(java.lang.Object obj,
java.lang.reflect.Method method,
java.lang.Object[] args)
throws java.lang.Throwable
- Implementation of a InvocationHandler
- Specified by:
invoke in interface java.lang.reflect.InvocationHandler