// Create an interface with all public methods of the target class
// in order to create a dynamic proxy
String subClassIntfName = EJBUtils.getGeneratedOptionalInterfaceName(targetObjectClass.getName());
EjbOptionalIntfGenerator gen = new EjbOptionalIntfGenerator(targetObjectClass.getClassLoader());
gen.generateOptionalLocalInterface(targetObjectClass, subClassIntfName);
Class subClassIntf = gen.loadClass(subClassIntfName);
String beanSubClassName = subClassIntfName + "__Bean__";
// Generate a sub-class of the application's class. Use an instance of this subclass
// as the actual object passed back to the application. The sub-class instance
// delegates all public methods to the dyanamic proxy, which calls the
// InvocationHandler.
gen.generateOptionalLocalInterfaceSubClass(
targetObjectClass, beanSubClassName, subClassIntf);
Class subClass = gen.loadClass(beanSubClassName);
// TODO do interceptor builder once per managed bean
InterceptorManager interceptorManager = new InterceptorManager(_logger,
targetObjectClass.getClassLoader(), targetObjectClass.getName(),