FileDocCategorySizeDatePackage
MethodCountingHandler.javaAPI DocExample1939Sun Dec 14 22:47:40 GMT 2003oreilly.hcj.proxies

MethodCountingHandler

public class MethodCountingHandler extends Object implements InvocationHandler
An invocation handler that counts the number of calls for all methods in the target class.
author
Robert Simmons jr. (kraythe)
version
$Revision: 1.2 $
see
java.lang.reflect.InvocationHandler

Fields Summary
private final Object
impl
The implementation object for this proxy.
private int
invocationCount
Holds the invocation count.
Constructors Summary
public MethodCountingHandler(Object impl)
Creates a new MethodCOuntingHandler object.

param
impl


	        	 
	    
		this.impl = impl;
	
Methods Summary
public intgetInvocationCount()
Gets the value of the property invocationCount.

return
The current value of invocationCount

		return invocationCount;
	
public java.lang.Objectinvoke(java.lang.Object proxy, java.lang.reflect.Method meth, java.lang.Object[] args)

see
java.lang.reflect.InvocationHandler#invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])

		try {
			this.invocationCount++;
			Object result = meth.invoke(impl, args);
			return result;
		} catch (final InvocationTargetException ex) {
			throw ex.getTargetException();
		}