MethodCountingHandlerpublic class MethodCountingHandler extends Object implements InvocationHandlerAn invocation handler that counts the number of calls for all methods in the target
class. |
Fields Summary |
---|
private final Object | implThe implementation object for this proxy. | private int | invocationCountHolds the invocation count. |
Constructors Summary |
---|
public MethodCountingHandler(Object impl)Creates a new MethodCOuntingHandler object.
this.impl = impl;
|
Methods Summary |
---|
public int | getInvocationCount()Gets the value of the property invocationCount.
return invocationCount;
| public java.lang.Object | invoke(java.lang.Object proxy, java.lang.reflect.Method meth, java.lang.Object[] args)
try {
this.invocationCount++;
Object result = meth.invoke(impl, args);
return result;
} catch (final InvocationTargetException ex) {
throw ex.getTargetException();
}
|
|