@Test public void container_shouldExposeAllProvidedInterfacesOfAComponent() { ComponentRuntime runtime = new ComponentRuntime( EXECUTOR, Collections.emptyList(), Component.builder(Child.class, Parent.class).factory(c -> new Child()).build()); Provider<Child> child = runtime.getProvider(Child.class); assertThat(child).isNotNull(); Provider<Parent> parent = runtime.getProvider(Parent.class); assertThat(parent).isNotNull(); assertThat(child).isSameInstanceAs(parent); assertThat(child.get()).isSameInstanceAs(parent.get()); }
@Override @SuppressWarnings("unchecked") public <T> Provider<T> getProvider(Class<T> anInterface) { Preconditions.checkNotNull(anInterface, "Null interface requested."); return (Provider<T>) lazyInstanceMap.get(anInterface); }
ComponentRuntime extends AbstractComponentContainer { @Override @SuppressWarnings("unchecked") public <T> Provider<T> getProvider(Class<T> anInterface) { Preconditions.checkNotNull(anInterface, "Null interface requested."); return (Provider<T>) lazyInstanceMap.get(anInterface); } }
ComponentRuntime extends AbstractComponentContainer { @Override @SuppressWarnings("unchecked") public <T> Provider<T> getProvider(Class<T> anInterface) { Preconditions.checkNotNull(anInterface, "Null interface requested."); return (Provider<T>) lazyInstanceMap.get(anInterface); } ComponentRuntime(
      Executor defaultEventExecutor,
      Iterable<ComponentRegistrar> registrars,
      Component<?>... additionalComponents); }
ComponentRuntime extends AbstractComponentContainer { @Override @SuppressWarnings("unchecked") public <T> Provider<T> getProvider(Class<T> anInterface) { Preconditions.checkNotNull(anInterface, "Null interface requested."); return (Provider<T>) lazyInstanceMap.get(anInterface); } ComponentRuntime(
      Executor defaultEventExecutor,
      Iterable<ComponentRegistrar> registrars,
      Component<?>... additionalComponents); @Override @SuppressWarnings("unchecked") Provider<T> getProvider(Class<T> anInterface); @Override @SuppressWarnings("unchecked") Provider<Set<T>> setOfProvider(Class<T> anInterface); void initializeEagerComponents(boolean isDefaultApp); @VisibleForTesting @RestrictTo(Scope.TESTS) void initializeAllComponentsForTests(); }
ComponentRuntime extends AbstractComponentContainer { @Override @SuppressWarnings("unchecked") public <T> Provider<T> getProvider(Class<T> anInterface) { Preconditions.checkNotNull(anInterface, "Null interface requested."); return (Provider<T>) lazyInstanceMap.get(anInterface); } ComponentRuntime(
      Executor defaultEventExecutor,
      Iterable<ComponentRegistrar> registrars,
      Component<?>... additionalComponents); @Override @SuppressWarnings("unchecked") Provider<T> getProvider(Class<T> anInterface); @Override @SuppressWarnings("unchecked") Provider<Set<T>> setOfProvider(Class<T> anInterface); void initializeEagerComponents(boolean isDefaultApp); @VisibleForTesting @RestrictTo(Scope.TESTS) void initializeAllComponentsForTests();  }