@Override public <S extends T> ScopedBindingBuilder toConstructor( Constructor<S> constructor, TypeLiteral<? extends S> type) { checkNotNull(constructor, "constructor"); checkNotNull(type, "type"); checkNotTargetted(); BindingImpl<T> base = getBinding(); Set<InjectionPoint> injectionPoints; try { injectionPoints = InjectionPoint.forInstanceMethodsAndFields(type); } catch (ConfigurationException e) { copyErrorsToBinder(e); injectionPoints = e.getPartialValue(); } try { InjectionPoint constructorPoint = InjectionPoint.forConstructor(constructor, type); setBinding( new ConstructorBindingImpl<T>( base.getKey(), base.getSource(), base.getScoping(), constructorPoint, injectionPoints)); } catch (ConfigurationException e) { copyErrorsToBinder(e); } return this; }
InjectionPoint.forConstructor( (Constructor<? super T>) matchingConstructor, implementation); return ip;
InjectionPoint ip = InjectionPoint.forConstructor( (Constructor<? super T>) matchingConstructor, implementation); return ip;
public <S extends T> ScopedBindingBuilder toConstructor(Constructor<S> constructor, TypeLiteral<? extends S> type) { checkNotNull(constructor, "constructor"); checkNotNull(type, "type"); checkNotTargetted(); BindingImpl<T> base = getBinding(); Set<InjectionPoint> injectionPoints; try { injectionPoints = InjectionPoint.forInstanceMethodsAndFields(type); } catch (ConfigurationException e) { copyErrorsToBinder(e); injectionPoints = e.getPartialValue(); } try { InjectionPoint constructorPoint = InjectionPoint.forConstructor(constructor, type); setBinding(new ConstructorBindingImpl<T>(base.getKey(), base.getSource(), base.getScoping(), constructorPoint, injectionPoints)); } catch (ConfigurationException e) { copyErrorsToBinder(e); } return this; }
InjectionPoint ip = InjectionPoint.forConstructor( (Constructor)matchingConstructor, implementation); return ip;
@Override public <S extends T> ScopedBindingBuilder toConstructor( Constructor<S> constructor, TypeLiteral<? extends S> type) { checkNotNull(constructor, "constructor"); checkNotNull(type, "type"); checkNotTargetted(); BindingImpl<T> base = getBinding(); Set<InjectionPoint> injectionPoints; try { injectionPoints = InjectionPoint.forInstanceMethodsAndFields(type); } catch (ConfigurationException e) { copyErrorsToBinder(e); injectionPoints = e.getPartialValue(); } try { InjectionPoint constructorPoint = InjectionPoint.forConstructor(constructor, type); setBinding( new ConstructorBindingImpl<T>( base.getKey(), base.getSource(), base.getScoping(), constructorPoint, injectionPoints)); } catch (ConfigurationException e) { copyErrorsToBinder(e); } return this; }
InjectionPoint.forConstructor( (Constructor<? super T>) matchingConstructor, implementation); return ip;
@Override public <S extends T> ScopedBindingBuilder toConstructor( Constructor<S> constructor, TypeLiteral<? extends S> type) { checkNotNull(constructor, "constructor"); checkNotNull(type, "type"); checkNotTargetted(); BindingImpl<T> base = getBinding(); Set<InjectionPoint> injectionPoints; try { injectionPoints = InjectionPoint.forInstanceMethodsAndFields(type); } catch (ConfigurationException e) { copyErrorsToBinder(e); injectionPoints = e.getPartialValue(); } try { InjectionPoint constructorPoint = InjectionPoint.forConstructor(constructor, type); setBinding( new ConstructorBindingImpl<T>( base.getKey(), base.getSource(), base.getScoping(), constructorPoint, injectionPoints)); } catch (ConfigurationException e) { copyErrorsToBinder(e); } return this; }
InjectionPoint ip = InjectionPoint.forConstructor( (Constructor)matchingConstructor, implementation); return ip;
public void testLinkedAndInstanceBindings() throws Exception { grapher.graph( Guice.createInjector( new AbstractModule() { @Override protected void configure() { bind(IA.class).to(A.class); bind(IA.class).annotatedWith(Ann.class).to(A.class); bind(String.class).toInstance(TEST_STRING); } })); Set<Node> expectedNodes = ImmutableSet.<Node>of(iaNode, iaAnnNode, aNode, stringNode, stringInstanceNode); Set<Edge> expectedEdges = ImmutableSet.<Edge>of( new BindingEdge(iaNode.getId(), aNode.getId(), BindingEdge.Type.NORMAL), new BindingEdge(iaAnnNode.getId(), aNode.getId(), BindingEdge.Type.NORMAL), new BindingEdge( stringNode.getId(), stringInstanceNode.getId(), BindingEdge.Type.NORMAL), new DependencyEdge( aNode.getId(), stringNode.getId(), InjectionPoint.forConstructor(A.class.getConstructor(String.class)))); assertEquals(expectedNodes, grapher.nodes); assertEquals(expectedEdges, grapher.edges); }
InjectionPoint.forConstructor( (Constructor<? super T>) matchingConstructor, implementation); return ip;
public <S extends T> ScopedBindingBuilder toConstructor(Constructor<S> constructor, TypeLiteral<? extends S> type) { checkNotNull(constructor, "constructor"); checkNotNull(type, "type"); checkNotTargetted(); BindingImpl<T> base = getBinding(); Set<InjectionPoint> injectionPoints; try { injectionPoints = InjectionPoint.forInstanceMethodsAndFields(type); } catch (ConfigurationException e) { copyErrorsToBinder(e); injectionPoints = e.getPartialValue(); } try { @SuppressWarnings("unchecked") // safe; constructor is a subtype of toConstruct InjectionPoint constructorPoint = InjectionPoint.forConstructor(constructor, type); setBinding(new ConstructorBindingImpl<T>(base.getKey(), base.getSource(), base.getScoping(), constructorPoint, injectionPoints)); } catch (ConfigurationException e) { copyErrorsToBinder(e); } return this; }
public <S extends T> ScopedBindingBuilder toConstructor(Constructor<S> constructor, TypeLiteral<? extends S> type) { checkNotNull(constructor, "constructor"); checkNotNull(type, "type"); checkNotTargetted(); BindingImpl<T> base = getBinding(); Set<InjectionPoint> injectionPoints; try { injectionPoints = InjectionPoint.forInstanceMethodsAndFields(type); } catch (ConfigurationException e) { copyErrorsToBinder(e); injectionPoints = e.getPartialValue(); } try { @SuppressWarnings("unchecked") // safe; constructor is a subtype of toConstruct InjectionPoint constructorPoint = InjectionPoint.forConstructor(constructor, type); setBinding(new ConstructorBindingImpl<T>(base.getKey(), base.getSource(), base.getScoping(), constructorPoint, injectionPoints)); } catch (ConfigurationException e) { copyErrorsToBinder(e); } return this; }
public <S extends T> ScopedBindingBuilder toConstructor(Constructor<S> constructor, TypeLiteral<? extends S> type) { checkNotNull(constructor, "constructor"); checkNotNull(type, "type"); checkNotTargetted(); BindingImpl<T> base = getBinding(); Set<InjectionPoint> injectionPoints; try { injectionPoints = InjectionPoint.forInstanceMethodsAndFields(type); } catch (ConfigurationException e) { copyErrorsToBinder(e); injectionPoints = e.getPartialValue(); } try { @SuppressWarnings("unchecked") // safe; constructor is a subtype of toConstruct InjectionPoint constructorPoint = InjectionPoint.forConstructor(constructor, type); setBinding(new ConstructorBindingImpl<T>(base.getKey(), base.getSource(), base.getScoping(), constructorPoint, injectionPoints)); } catch (ConfigurationException e) { copyErrorsToBinder(e); } return this; }
a2Node.getId(), stringNode.getId(), InjectionPoint.forConstructor(A2.class.getConstructor(Provider.class))), new DependencyEdge(a2ProviderNode.getId(), a2Node.getId(), null)); assertEquals("wrong nodes", expectedNodes, grapher.nodes);