Java Code Examples for com.google.inject.Injector#findBindingsByType()
The following examples show how to use
com.google.inject.Injector#findBindingsByType() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractComposite.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Inject public AbstractComposite(Class<T> clazz, Injector injector) { List<Binding<T>> bindingsByType = injector.findBindingsByType(TypeLiteral .get(clazz)); for (Binding<T> binding : bindingsByType) { try { elements.add(binding.getProvider().get()); } catch (RuntimeException e) { handle(e); } } }
Example 2
Source File: IOutlineContribution.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Inject protected void initialize(Injector injector) { contributions = Lists.newArrayList(); List<Binding<IOutlineContribution>> bindings = injector.findBindingsByType(TypeLiteral .get(IOutlineContribution.class)); for (Binding<IOutlineContribution> binding : bindings) { contributions.add(injector.getInstance(binding.getKey())); } }
Example 3
Source File: IQuickOutlineContribution.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Inject protected void initialize(Injector injector) { contributions = Lists.newArrayList(); List<Binding<IQuickOutlineContribution>> bindings = injector.findBindingsByType(TypeLiteral .get(IQuickOutlineContribution.class)); for (Binding<IQuickOutlineContribution> binding : bindings) { contributions.add(injector.getInstance(binding.getKey())); } }
Example 4
Source File: CompoundXtextEditorCallback.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Inject public CompoundXtextEditorCallback(Injector injector) { List<Binding<IXtextEditorCallback>> bindingsByType = injector == null ? Lists .<Binding<IXtextEditorCallback>> newArrayList() : injector.findBindingsByType(TypeLiteral .get(IXtextEditorCallback.class)); for (Binding<IXtextEditorCallback> binding : bindingsByType) { try { editorCallbacks.add(binding.getProvider().get()); } catch (Exception e) { handle(e); } } }
Example 5
Source File: XtextDocumentReconcileStrategy.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Inject private void initializeStrategyFactories(Injector injector) { List<Binding<IReconcileStrategyFactory>> bindingsByType = injector == null ? Lists .<Binding<IReconcileStrategyFactory>> newArrayList() : injector.findBindingsByType(TypeLiteral .get(IReconcileStrategyFactory.class)); for (Binding<IReconcileStrategyFactory> binding : bindingsByType) { try { strategyFactories.add(binding.getProvider().get()); } catch (Exception e) { throw new RuntimeException(e); } } }
Example 6
Source File: DefaultJoynrRuntimeFactoryTest.java From joynr with Apache License 2.0 | 5 votes |
@Test public void testJoynrMessageProcessorAdded() throws Exception { createFixture(); Injector injector = fixture.getInjector(); List<Binding<JoynrMessageProcessor>> bindings = injector.findBindingsByType(new TypeLiteral<JoynrMessageProcessor>() { }); assertEquals(1, bindings.size()); }