@Test public void container_withValidDependencyGraph_withDefaultApp_shouldInitializeEagerComponentsAndTheirDependencies() { InitTracker initTracker = new InitTracker(); ComponentRuntime runtime = new ComponentRuntime( EXECUTOR, Collections.singletonList(new ComponentRegistrarImpl(Eagerness.ALWAYS)), Component.of(initTracker, InitTracker.class)); assertThat(initTracker.isInitialized()).isFalse(); runtime.initializeEagerComponents(true); assertThat(initTracker.isInitialized()).isTrue(); }
public void initializeEagerComponents(boolean isDefaultApp) { for (Map.Entry<Component<?>, Lazy<?>> entry : components.entrySet()) { Component<?> component = entry.getKey(); Lazy<?> lazy = entry.getValue(); if (component.isAlwaysEager() || (component.isEagerInDefaultApp() && isDefaultApp)) { lazy.get(); } } eventBus.enablePublishingAndFlushPending(); }
ComponentRuntime extends AbstractComponentContainer { public void initializeEagerComponents(boolean isDefaultApp) { for (Map.Entry<Component<?>, Lazy<?>> entry : components.entrySet()) { Component<?> component = entry.getKey(); Lazy<?> lazy = entry.getValue(); if (component.isAlwaysEager() || (component.isEagerInDefaultApp() && isDefaultApp)) { lazy.get(); } } eventBus.enablePublishingAndFlushPending(); } }
ComponentRuntime extends AbstractComponentContainer { public void initializeEagerComponents(boolean isDefaultApp) { for (Map.Entry<Component<?>, Lazy<?>> entry : components.entrySet()) { Component<?> component = entry.getKey(); Lazy<?> lazy = entry.getValue(); if (component.isAlwaysEager() || (component.isEagerInDefaultApp() && isDefaultApp)) { lazy.get(); } } eventBus.enablePublishingAndFlushPending(); } ComponentRuntime(
      Executor defaultEventExecutor,
      Iterable<ComponentRegistrar> registrars,
      Component<?>... additionalComponents); }
ComponentRuntime extends AbstractComponentContainer { public void initializeEagerComponents(boolean isDefaultApp) { for (Map.Entry<Component<?>, Lazy<?>> entry : components.entrySet()) { Component<?> component = entry.getKey(); Lazy<?> lazy = entry.getValue(); if (component.isAlwaysEager() || (component.isEagerInDefaultApp() && isDefaultApp)) { lazy.get(); } } eventBus.enablePublishingAndFlushPending(); } 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 { public void initializeEagerComponents(boolean isDefaultApp) { for (Map.Entry<Component<?>, Lazy<?>> entry : components.entrySet()) { Component<?> component = entry.getKey(); Lazy<?> lazy = entry.getValue(); if (component.isAlwaysEager() || (component.isEagerInDefaultApp() && isDefaultApp)) { lazy.get(); } } eventBus.enablePublishingAndFlushPending(); } 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();  }