public ConstructorBindingImpl( Key<T> key, Object source, Scoping scoping, InjectionPoint constructorInjectionPoint, Set<InjectionPoint> injectionPoints) { super(source, key, scoping); this.factory = new Factory<>(false, key); ConstructionProxy<T> constructionProxy = new DefaultConstructionProxyFactory<T>(constructorInjectionPoint).create(); this.constructorInjectionPoint = constructorInjectionPoint; factory.constructorInjector = new ConstructorInjector<T>(injectionPoints, constructionProxy, null, null); }
@Override public ConstructionProxy<T> create() throws ErrorsException { if (interceptors.isEmpty()) { return new DefaultConstructionProxyFactory<T>(injectionPoint).create(); } @SuppressWarnings("unchecked") Class<? extends Callback>[] callbackTypes = new Class[callbacks.length]; for (int i = 0; i < callbacks.length; i++) { if (callbacks[i] == net.sf.cglib.proxy.NoOp.INSTANCE) { callbackTypes[i] = net.sf.cglib.proxy.NoOp.class; } else { callbackTypes[i] = net.sf.cglib.proxy.MethodInterceptor.class; } } // Create the proxied class. We're careful to ensure that all enhancer state is not-specific // to this injector. Otherwise, the proxies for each injector will waste PermGen memory try { Enhancer enhancer = BytecodeGen.newEnhancer(declaringClass, visibility); enhancer.setCallbackFilter(new IndicesCallbackFilter(methods)); enhancer.setCallbackTypes(callbackTypes); return new ProxyConstructor<T>(enhancer, injectionPoint, callbacks, interceptors); } catch (Throwable e) { throw new Errors().errorEnhancingClass(declaringClass, e).toException(); } }
public ConstructorBindingImpl(Key<T> key, Object source, Scoping scoping, InjectionPoint constructorInjectionPoint, Set<InjectionPoint> injectionPoints) { super(source, key, scoping); this.factory = new Factory<T>(false, key); ConstructionProxy<T> constructionProxy = new DefaultConstructionProxyFactory<T>(constructorInjectionPoint).create(); this.constructorInjectionPoint = constructorInjectionPoint; factory.constructorInjector = new ConstructorInjector<T>( injectionPoints, constructionProxy, null, null); }
public ConstructorBindingImpl(Key<T> key, Object source, Scoping scoping, InjectionPoint constructorInjectionPoint, Set<InjectionPoint> injectionPoints) { super(source, key, scoping); this.factory = new Factory<T>(false, key); ConstructionProxy<T> constructionProxy = new DefaultConstructionProxyFactory<T>(constructorInjectionPoint).create(); this.constructorInjectionPoint = constructorInjectionPoint; factory.constructorInjector = new ConstructorInjector<T>( injectionPoints, constructionProxy, null, null); }
public ConstructorBindingImpl( Key<T> key, Object source, Scoping scoping, InjectionPoint constructorInjectionPoint, Set<InjectionPoint> injectionPoints) { super(source, key, scoping); this.factory = new Factory<>(false, key); ConstructionProxy<T> constructionProxy = new DefaultConstructionProxyFactory<T>(constructorInjectionPoint).create(); this.constructorInjectionPoint = constructorInjectionPoint; factory.constructorInjector = new ConstructorInjector<T>(injectionPoints, constructionProxy, null, null); }
public ConstructorBindingImpl(Key<T> key, Object source, Scoping scoping, InjectionPoint constructorInjectionPoint, Set<InjectionPoint> injectionPoints) { super(source, key, scoping); this.factory = new Factory<T>(false, key); ConstructionProxy<T> constructionProxy = new DefaultConstructionProxyFactory<T>(constructorInjectionPoint).create(); this.constructorInjectionPoint = constructorInjectionPoint; factory.constructorInjector = new ConstructorInjector<T>( injectionPoints, constructionProxy, null, null); }
public ConstructorBindingImpl(Key<T> key, Object source, Scoping scoping, InjectionPoint constructorInjectionPoint, Set<InjectionPoint> injectionPoints) { super(source, key, scoping); this.factory = new Factory<T>(false, key); ConstructionProxy<T> constructionProxy = new DefaultConstructionProxyFactory<T>(constructorInjectionPoint).create(); this.constructorInjectionPoint = constructorInjectionPoint; factory.constructorInjector = new ConstructorInjector<T>( injectionPoints, constructionProxy, null, null); }
public ConstructorBindingImpl( Key<T> key, Object source, Scoping scoping, InjectionPoint constructorInjectionPoint, Set<InjectionPoint> injectionPoints) { super(source, key, scoping); this.factory = new Factory<>(false, key); ConstructionProxy<T> constructionProxy = new DefaultConstructionProxyFactory<T>(constructorInjectionPoint).create(); this.constructorInjectionPoint = constructorInjectionPoint; factory.constructorInjector = new ConstructorInjector<T>(injectionPoints, constructionProxy, null, null); }
@Override public ConstructionProxy<T> create() throws ErrorsException { if (interceptors.isEmpty()) { return new DefaultConstructionProxyFactory<T>(injectionPoint).create(); } @SuppressWarnings("unchecked") Class<? extends Callback>[] callbackTypes = new Class[callbacks.length]; for (int i = 0; i < callbacks.length; i++) { if (callbacks[i] == net.sf.cglib.proxy.NoOp.INSTANCE) { callbackTypes[i] = net.sf.cglib.proxy.NoOp.class; } else { callbackTypes[i] = net.sf.cglib.proxy.MethodInterceptor.class; } } // Create the proxied class. We're careful to ensure that all enhancer state is not-specific // to this injector. Otherwise, the proxies for each injector will waste PermGen memory try { Enhancer enhancer = BytecodeGen.newEnhancer(declaringClass, visibility); enhancer.setCallbackFilter(new IndicesCallbackFilter(methods)); enhancer.setCallbackTypes(callbackTypes); return new ProxyConstructor<T>(enhancer, injectionPoint, callbacks, interceptors); } catch (Throwable e) { throw new Errors().errorEnhancingClass(declaringClass, e).toException(); } }
public ConstructionProxy<T> create() throws ErrorsException { if (interceptors.isEmpty()) { return new DefaultConstructionProxyFactory<T>(injectionPoint).create(); } @SuppressWarnings("unchecked") Class<? extends Callback>[] callbackTypes = new Class[callbacks.length]; for (int i = 0; i < callbacks.length; i++) { if (callbacks[i] == net.sf.cglib.proxy.NoOp.INSTANCE) { callbackTypes[i] = net.sf.cglib.proxy.NoOp.class; } else { callbackTypes[i] = net.sf.cglib.proxy.MethodInterceptor.class; } } // Create the proxied class. We're careful to ensure that all enhancer state is not-specific // to this injector. Otherwise, the proxies for each injector will waste PermGen memory try { Enhancer enhancer = BytecodeGen.newEnhancer(declaringClass, visibility); enhancer.setCallbackFilter(new IndicesCallbackFilter(declaringClass, methods)); enhancer.setCallbackTypes(callbackTypes); return new ProxyConstructor<T>(enhancer, injectionPoint, callbacks, interceptors); } catch (Throwable e) { throw new Errors().errorEnhancingClass(declaringClass, e).toException(); } }
@Override public ConstructionProxy<T> create() throws ErrorsException { if (interceptors.isEmpty()) { return new DefaultConstructionProxyFactory<T>(injectionPoint).create(); } @SuppressWarnings("unchecked") Class<? extends Callback>[] callbackTypes = new Class[callbacks.length]; for (int i = 0; i < callbacks.length; i++) { if (callbacks[i] == net.sf.cglib.proxy.NoOp.INSTANCE) { callbackTypes[i] = net.sf.cglib.proxy.NoOp.class; } else { callbackTypes[i] = net.sf.cglib.proxy.MethodInterceptor.class; } } // Create the proxied class. We're careful to ensure that all enhancer state is not-specific // to this injector. Otherwise, the proxies for each injector will waste PermGen memory try { Enhancer enhancer = BytecodeGen.newEnhancer(declaringClass, visibility); enhancer.setCallbackFilter(new IndicesCallbackFilter(methods)); enhancer.setCallbackTypes(callbackTypes); return new ProxyConstructor<T>(enhancer, injectionPoint, callbacks, interceptors); } catch (Throwable e) { throw new Errors().errorEnhancingClass(declaringClass, e).toException(); } }