FileDocCategorySizeDatePackage
DemoDynamicProxy.javaAPI DocExample1292Sun Dec 14 22:47:38 GMT 2003oreilly.hcj.proxies

DemoDynamicProxy

public class DemoDynamicProxy extends Object
Demonstrates a dynamic proxy.
author
Robert Simmons jr. (kraythe)
version
$Revision: 1.2 $

Fields Summary
Constructors Summary
Methods Summary
public static final voidmain(java.lang.String[] args)
Run the demonstration.

param
args Command Line Arguments (ignored).

		SomeClass proxy = SomeClassFactory.getDynamicSomeClassProxy();
		proxy.someMethod();
		proxy.someOtherMethod("Our Proxy works!");

		InvocationHandler handler = Proxy.getInvocationHandler(proxy);
		if (handler instanceof MethodCountingHandler) {
			System.out.println(((MethodCountingHandler)handler).getInvocationCount());
		}