/** Returns a set of dependencies that can be iterated over to clean up stray JIT bindings. */ Set<Dependency<?>> getInternalDependencies() { ImmutableSet.Builder<InjectionPoint> builder = ImmutableSet.builder(); if (factory.constructorInjector == null) { builder.add(constructorInjectionPoint); // If the below throws, it's OK -- we just ignore those dependencies, because no one // could have used them anyway. try { builder.addAll( InjectionPoint.forInstanceMethodsAndFields( constructorInjectionPoint.getDeclaringType())); } catch (ConfigurationException ignored) { } } else { builder.add(getConstructor()).addAll(getInjectableMembers()); } return Dependency.forInjectionPoints(builder.build()); }
@Override @SuppressWarnings("unchecked") // the raw constructor member and declaring type always agree public void applyTo(Binder binder) { InjectionPoint constructor = getConstructor(); getScoping() .applyTo( binder .withSource(getSource()) .bind(getKey()) .toConstructor( (Constructor) getConstructor().getMember(), (TypeLiteral) constructor.getDeclaringType())); }
MembersInjectorImpl<T> membersInjector = (MembersInjectorImpl<T>) injector.membersInjectorStore.get(injectionPoint.getDeclaringType(), errors);
constructorInjector == null ? key.getTypeLiteral().getRawType() : (Class) constructorInjector.getDeclaringType().getRawType();
@Override public Class<?> visit( final ConstructorBinding<?> binding ) { return binding.getConstructor().getDeclaringType().getRawType(); }
/** Returns a set of dependencies that can be iterated over to clean up stray JIT bindings. */ Set<Dependency<?>> getInternalDependencies() { ImmutableSet.Builder<InjectionPoint> builder = ImmutableSet.builder(); if (factory.constructorInjector == null) { builder.add(constructorInjectionPoint); // If the below throws, it's OK -- we just ignore those dependencies, because no one // could have used them anyway. try { builder.addAll( InjectionPoint.forInstanceMethodsAndFields( constructorInjectionPoint.getDeclaringType())); } catch (ConfigurationException ignored) { } } else { builder.add(getConstructor()).addAll(getInjectableMembers()); } return Dependency.forInjectionPoints(builder.build()); }
/** Returns a set of dependencies that can be iterated over to clean up stray JIT bindings. */ Set<Dependency<?>> getInternalDependencies() { ImmutableSet.Builder<InjectionPoint> builder = ImmutableSet.builder(); if (factory.constructorInjector == null) { builder.add(constructorInjectionPoint); // If the below throws, it's OK -- we just ignore those dependencies, because no one // could have used them anyway. try { builder.addAll( InjectionPoint.forInstanceMethodsAndFields( constructorInjectionPoint.getDeclaringType())); } catch (ConfigurationException ignored) { } } else { builder.add(getConstructor()).addAll(getInjectableMembers()); } return Dependency.forInjectionPoints(builder.build()); }
/** * Returns a set of dependencies that can be iterated over to clean up stray JIT bindings. */ Set<Dependency<?>> getInternalDependencies() { ImmutableSet.Builder<InjectionPoint> builder = ImmutableSet.builder(); if (factory.constructorInjector == null) { builder.add(constructorInjectionPoint); // If the below throws, it's OK -- we just ignore those dependencies, because no one // could have used them anyway. try { builder.addAll(InjectionPoint.forInstanceMethodsAndFields(constructorInjectionPoint.getDeclaringType())); } catch (ConfigurationException ignored) { } } else { builder.add(getConstructor()) .addAll(getInjectableMembers()); } return Dependency.forInjectionPoints(builder.build()); }
@SuppressWarnings("unchecked") // the raw constructor member and declaring type always agree public void applyTo(Binder binder) { InjectionPoint constructor = getConstructor(); getScoping().applyTo(binder.withSource(getSource()).bind(getKey()).toConstructor( (Constructor) getConstructor().getMember(), (TypeLiteral) constructor.getDeclaringType())); }
@SuppressWarnings("unchecked") // the raw constructor member and declaring type always agree public void applyTo(Binder binder) { InjectionPoint constructor = getConstructor(); getScoping().applyTo(binder.withSource(getSource()).bind(getKey()).toConstructor( (Constructor) getConstructor().getMember(), (TypeLiteral) constructor.getDeclaringType())); }
@SuppressWarnings("unchecked") // the raw constructor member and declaring type always agree public void applyTo(Binder binder) { InjectionPoint constructor = getConstructor(); getScoping().applyTo(binder.withSource(getSource()).bind(getKey()).toConstructor( (Constructor) getConstructor().getMember(), (TypeLiteral) constructor.getDeclaringType())); }
@SuppressWarnings("unchecked") // the raw constructor member and declaring type always agree public void applyTo(Binder binder) { InjectionPoint constructor = getConstructor(); getScoping().applyTo(binder.withSource(getSource()).bind(getKey()).toConstructor( (Constructor) getConstructor().getMember(), (TypeLiteral) constructor.getDeclaringType())); }
@Override @SuppressWarnings("unchecked") // the raw constructor member and declaring type always agree public void applyTo(Binder binder) { InjectionPoint constructor = getConstructor(); getScoping() .applyTo( binder .withSource(getSource()) .bind(getKey()) .toConstructor( (Constructor) getConstructor().getMember(), (TypeLiteral) constructor.getDeclaringType())); }
@Override @SuppressWarnings("unchecked") // the raw constructor member and declaring type always agree public void applyTo(Binder binder) { InjectionPoint constructor = getConstructor(); getScoping() .applyTo( binder .withSource(getSource()) .bind(getKey()) .toConstructor( (Constructor) getConstructor().getMember(), (TypeLiteral) constructor.getDeclaringType())); }
private <T> ConstructorInjector<T> createConstructor(InjectionPoint injectionPoint, Errors errors) throws ErrorsException { int numErrorsBefore = errors.size(); SingleParameterInjector<?>[] constructorParameterInjectors = injector.getParametersInjectors(injectionPoint.getDependencies(), errors); @SuppressWarnings("unchecked") // the injector type agrees with the injection point type MembersInjectorImpl<T> membersInjector = (MembersInjectorImpl<T>) injector.membersInjectorStore .get(injectionPoint.getDeclaringType(), errors); ConstructionProxyFactory<T> factory = new DefaultConstructionProxyFactory<T>(injectionPoint); errors.throwIfNewErrors(numErrorsBefore); return new ConstructorInjector<T>(membersInjector.getInjectionPoints(), factory.create(), constructorParameterInjectors, membersInjector); } }
private <T> ConstructorInjector<T> createConstructor(InjectionPoint injectionPoint, Errors errors) throws ErrorsException { int numErrorsBefore = errors.size(); SingleParameterInjector<?>[] constructorParameterInjectors = injector.getParametersInjectors(injectionPoint.getDependencies(), errors); @SuppressWarnings("unchecked") // the injector type agrees with the injection point type MembersInjectorImpl<T> membersInjector = (MembersInjectorImpl<T>) injector.membersInjectorStore .get(injectionPoint.getDeclaringType(), errors); /*if[AOP]*/ ImmutableList<MethodAspect> injectorAspects = injector.state.getMethodAspects(); ImmutableList<MethodAspect> methodAspects = membersInjector.getAddedAspects().isEmpty() ? injectorAspects : ImmutableList.copyOf(concat(injectorAspects, membersInjector.getAddedAspects())); ConstructionProxyFactory<T> factory = new ProxyFactory<T>(injectionPoint, methodAspects); /*end[AOP]*/ /*if[NO_AOP] ConstructionProxyFactory<T> factory = new DefaultConstructionProxyFactory<T>(injectionPoint); end[NO_AOP]*/ errors.throwIfNewErrors(numErrorsBefore); return new ConstructorInjector<T>(membersInjector.getInjectionPoints(), factory.create(), constructorParameterInjectors, membersInjector); } }
private <T> ConstructorInjector<T> createConstructor(InjectionPoint injectionPoint, Errors errors) throws ErrorsException { int numErrorsBefore = errors.size(); SingleParameterInjector<?>[] constructorParameterInjectors = injector.getParametersInjectors(injectionPoint.getDependencies(), errors); @SuppressWarnings("unchecked") // the injector type agrees with the injection point type MembersInjectorImpl<T> membersInjector = (MembersInjectorImpl<T>) injector.membersInjectorStore .get(injectionPoint.getDeclaringType(), errors); /*if[AOP]*/ ImmutableList<MethodAspect> injectorAspects = injector.state.getMethodAspects(); ImmutableList<MethodAspect> methodAspects = membersInjector.getAddedAspects().isEmpty() ? injectorAspects : ImmutableList.copyOf(concat(injectorAspects, membersInjector.getAddedAspects())); ConstructionProxyFactory<T> factory = new ProxyFactory<T>(injectionPoint, methodAspects); /*end[AOP]*/ /*if[NO_AOP] ConstructionProxyFactory<T> factory = new DefaultConstructionProxyFactory<T>(injectionPoint); end[NO_AOP]*/ errors.throwIfNewErrors(numErrorsBefore); return new ConstructorInjector<T>(membersInjector.getInjectionPoints(), factory.create(), constructorParameterInjectors, membersInjector); } }
/** Returns a set of dependencies that can be iterated over to clean up stray JIT bindings. */ Set<Dependency<?>> getInternalDependencies() { ImmutableSet.Builder<InjectionPoint> builder = ImmutableSet.builder(); if(factory.constructorInjector == null) { builder.add(constructorInjectionPoint); // If the below throws, it's OK -- we just ignore those dependencies, because no one // could have used them anyway. try { builder.addAll(InjectionPoint.forInstanceMethodsAndFields(constructorInjectionPoint.getDeclaringType())); } catch(ConfigurationException ignored) {} } else { builder.add(getConstructor()) .addAll(getInjectableMembers()); } return Dependency.forInjectionPoints(builder.build()); }
/** Returns a set of dependencies that can be iterated over to clean up stray JIT bindings. */ Set<Dependency<?>> getInternalDependencies() { ImmutableSet.Builder<InjectionPoint> builder = ImmutableSet.builder(); if(factory.constructorInjector == null) { builder.add(constructorInjectionPoint); // If the below throws, it's OK -- we just ignore those dependencies, because no one // could have used them anyway. try { builder.addAll(InjectionPoint.forInstanceMethodsAndFields(constructorInjectionPoint.getDeclaringType())); } catch(ConfigurationException ignored) {} } else { builder.add(getConstructor()) .addAll(getInjectableMembers()); } return Dependency.forInjectionPoints(builder.build()); }
/** Returns a set of dependencies that can be iterated over to clean up stray JIT bindings. */ Set<Dependency<?>> getInternalDependencies() { ImmutableSet.Builder<InjectionPoint> builder = ImmutableSet.builder(); if(factory.constructorInjector == null) { builder.add(constructorInjectionPoint); // If the below throws, it's OK -- we just ignore those dependencies, because no one // could have used them anyway. try { builder.addAll(InjectionPoint.forInstanceMethodsAndFields(constructorInjectionPoint.getDeclaringType())); } catch(ConfigurationException ignored) {} } else { builder.add(getConstructor()) .addAll(getInjectableMembers()); } return Dependency.forInjectionPoints(builder.build()); }