/** * Builds the. * * @return the injector */ Injector build() { if (shellBuilder == null) { throw new AssertionError("Already built, builders are not reusable."); } synchronized (shellBuilder.lock()) { shells = shellBuilder.build(initializer, bindingProcesor, stopwatch, errors); stopwatch.resetAndLog("Injector construction"); initializeStatically(); } if (stage == Stage.TOOL) { return new ToolStageInjector(primaryInjector()); } injectDynamically(); return primaryInjector(); }
/** * Parent injector. * * @param parent the parent * @return the injector builder */ InjectorBuilder parentInjector(InjectorImpl parent) { shellBuilder.parent(parent); return stage(parent.getInstance(Stage.class)); }
/** * Adds the modules. * * @param modules the modules * @return the injector builder */ InjectorBuilder addModules(Iterable<? extends Module> modules) { shellBuilder.addModules(modules); return this; }
/** * Stage. * * @param stage the stage * @return the injector builder */ InjectorBuilder stage(Stage stage) { shellBuilder.stage(stage); this.stage = stage; return this; }