private Constructor findConstructor() { Class componentClass = _classFab.createClass(); // The fabricated base class always has exactly one constructor return componentClass.getConstructors()[0]; }
private Constructor findConstructor() { Class componentClass = _classFab.createClass(); // The fabricated base class always has exactly one constructor return componentClass.getConstructors()[0]; }
/** * Creates a class that implements the service interface. Implements a private synchronized * method, _service(), that constructs the service as needed, and has each service interface * method re-invoke on _service(). Adds a toString() method if the service interface does not * define toString(). */ public static Object createDelegatingProxy(String type, ServiceModel serviceModel, String delegationMethodName, ServicePoint servicePoint) { ProxyBuilder builder = new ProxyBuilder(type, servicePoint); ClassFab classFab = builder.getClassFab(); addConstructor(classFab, serviceModel); addServiceAccessor(classFab, delegationMethodName, servicePoint); builder.addServiceMethods(SERVICE_ACCESSOR_METHOD_NAME + "()"); Class proxyClass = classFab.createClass(); try { Constructor c = proxyClass.getConstructor(new Class[] { serviceModel.getClass() }); return c.newInstance(new Object[] { serviceModel }); } catch (Exception ex) { throw new ApplicationRuntimeException(ex); } }
/** * Assumes that the factory will keep cranking out instances of the same class. * * @since 1.1 */ private Class constructBridgeProxyClass(Object service) { ProxyBuilder builder = new ProxyBuilder("BridgeProxy", getServicePoint()); ClassFab cf = builder.getClassFab(); Class serviceType = service.getClass(); cf.addField("_service", serviceType); cf.addConstructor(new Class[] { serviceType }, null, "{ super(); _service = $1; }"); builder.addServiceMethods("_service"); return cf.createClass(); }
private Class constructInterceptorClass(InterceptorStack stack, List parameters) { Class serviceInterfaceClass = stack.getServiceInterface(); String name = ClassFabUtils.generateClassName(serviceInterfaceClass); ClassFab classFab = _factory.newClass(name, Object.class); classFab.addInterface(serviceInterfaceClass); createInfrastructure(stack, classFab); addServiceMethods(stack, classFab, parameters); return classFab.createClass(); }
Class proxyClass = classFab.createClass();
return classFab.createClass();
return classFab.createClass();