public InternalInjectorCreator() { injectionRequestProcessor = new InjectionRequestProcessor(errors, initializer); bindingData = new ProcessedBindingData(); }
private <T> void bindExposed(PrivateElements privateElements, Key<T> key) { ExposedKeyFactory<T> exposedKeyFactory = new ExposedKeyFactory<>(key, privateElements); bindingData.addCreationListener(exposedKeyFactory); putBinding( new ExposedBindingImpl<T>( injector, privateElements.getExposedSource(key), key, exposedKeyFactory, privateElements)); } }
/** * Schedule initialization of this binding to occur immediately after all bindings have been * initialially processed. */ protected void scheduleInitialization(BindingImpl<?> binding) { bindingData.addUninitializedBinding(asRunnable(binding)); }
bindingData.initializeBindings(); stopwatch.resetAndLog("Binding initialization"); stopwatch.resetAndLog("Collecting injection requests"); bindingData.runCreationListeners(errors); stopwatch.resetAndLog("Binding validation"); bindingData.initializeDelayedBindings(); stopwatch.resetAndLog("Delayed Binding initialization");
/** Initialize and validate everything. */ private void initializeStatically() { bindingData.initializeBindings(); stopwatch.resetAndLog("Binding initialization"); for (InjectorShell shell : shells) { shell.getInjector().index(); } stopwatch.resetAndLog("Binding indexing"); injectionRequestProcessor.process(shells); stopwatch.resetAndLog("Collecting injection requests"); bindingData.runCreationListeners(errors); stopwatch.resetAndLog("Binding validation"); injectionRequestProcessor.validate(); stopwatch.resetAndLog("Static validation"); initializer.validateOustandingInjections(errors); stopwatch.resetAndLog("Instance member validation"); new LookupProcessor(errors).process(shells); for (InjectorShell shell : shells) { ((DeferredLookups) shell.getInjector().lookups).initialize(errors); } stopwatch.resetAndLog("Provider verification"); for (InjectorShell shell : shells) { if (!shell.getElements().isEmpty()) { throw new AssertionError("Failed to execute " + shell.getElements()); } } errors.throwCreationExceptionIfErrorsExist(); }
/** * Schedule initialization for this binding to occur after all other static initialization of * bindings. */ protected void scheduleDelayedInitialization(BindingImpl<?> binding) { bindingData.addDelayedUninitializedBinding(asRunnable(binding)); }
bindingData.initializeBindings(); stopwatch.resetAndLog("Binding initialization"); stopwatch.resetAndLog("Collecting injection requests"); bindingData.runCreationListeners(errors); stopwatch.resetAndLog("Binding validation"); bindingData.initializeDelayedBindings(); stopwatch.resetAndLog("Delayed Binding initialization");
/** Initialize and validate everything. */ private void initializeStatically() { bindingData.initializeBindings(); stopwatch.resetAndLog("Binding initialization"); for (InjectorShell shell : shells) { shell.getInjector().index(); } stopwatch.resetAndLog("Binding indexing"); injectionRequestProcessor.process(shells); stopwatch.resetAndLog("Collecting injection requests"); bindingData.runCreationListeners(errors); stopwatch.resetAndLog("Binding validation"); injectionRequestProcessor.validate(); stopwatch.resetAndLog("Static validation"); initializer.validateOustandingInjections(errors); stopwatch.resetAndLog("Instance member validation"); new LookupProcessor(errors).process(shells); for (InjectorShell shell : shells) { ((DeferredLookups) shell.getInjector().lookups).initialize(errors); } stopwatch.resetAndLog("Provider verification"); for (InjectorShell shell : shells) { if (!shell.getElements().isEmpty()) { throw new AssertionError("Failed to execute " + shell.getElements()); } } errors.throwCreationExceptionIfErrorsExist(); }
/** * Schedule initialization for this binding to occur after all other static initialization of * bindings. */ protected void scheduleDelayedInitialization(BindingImpl<?> binding) { bindingData.addDelayedUninitializedBinding(asRunnable(binding)); }
@Override public Boolean visit(LinkedKeyBinding<? extends T> binding) { prepareBinding(); Key<? extends T> linkedKey = binding.getLinkedKey(); if (key.equals(linkedKey)) { errors.recursiveBinding(); } FactoryProxy<T> factory = new FactoryProxy<>(injector, key, linkedKey, source); bindingData.addCreationListener(factory); InternalFactory<? extends T> scopedFactory = Scoping.scope(key, injector, factory, source, scoping); putBinding( new LinkedBindingImpl<T>(injector, key, source, scopedFactory, scoping, linkedKey)); return true; }
bindingData.initializeBindings(); stopwatch.resetAndLog("Binding initialization"); stopwatch.resetAndLog("Collecting injection requests"); bindingData.runCreationListeners(errors); stopwatch.resetAndLog("Binding validation"); bindingData.initializeDelayedBindings(); stopwatch.resetAndLog("Delayed Binding initialization");
/** Initialize and validate everything. */ private void initializeStatically() { bindingData.initializeBindings(); stopwatch.resetAndLog("Binding initialization"); for (InjectorShell shell : shells) { shell.getInjector().index(); } stopwatch.resetAndLog("Binding indexing"); injectionRequestProcessor.process(shells); stopwatch.resetAndLog("Collecting injection requests"); bindingData.runCreationListeners(errors); stopwatch.resetAndLog("Binding validation"); injectionRequestProcessor.validate(); stopwatch.resetAndLog("Static validation"); initializer.validateOustandingInjections(errors); stopwatch.resetAndLog("Instance member validation"); new LookupProcessor(errors).process(shells); for (InjectorShell shell : shells) { ((DeferredLookups) shell.getInjector().lookups).initialize(errors); } stopwatch.resetAndLog("Provider verification"); for (InjectorShell shell : shells) { if (!shell.getElements().isEmpty()) { throw new AssertionError("Failed to execute " + shell.getElements()); } } errors.throwCreationExceptionIfErrorsExist(); }
protected void scheduleInitialization(final BindingImpl<?> binding) { bindingData.addUninitializedBinding(new Runnable() { public void run() { try { binding.getInjector().initializeBinding(binding, errors.withSource(source)); } catch (ErrorsException e) { errors.merge(e.getErrors()); } } }); } }
public InternalInjectorCreator() { injectionRequestProcessor = new InjectionRequestProcessor(errors, initializer); bindingData = new ProcessedBindingData(); }
/** * Schedule initialization for this binding to occur after all other static initialization of * bindings. */ protected void scheduleDelayedInitialization(BindingImpl<?> binding) { bindingData.addDelayedUninitializedBinding(asRunnable(binding)); }
@Override public Boolean visit(ProviderKeyBinding<? extends T> binding) { prepareBinding(); Key<? extends javax.inject.Provider<? extends T>> providerKey = binding.getProviderKey(); // always visited with Binding<T> @SuppressWarnings("unchecked") BoundProviderFactory<T> boundProviderFactory = new BoundProviderFactory<T>( injector, providerKey, source, injector.provisionListenerStore.get((ProviderKeyBinding<T>) binding)); bindingData.addCreationListener(boundProviderFactory); InternalFactory<? extends T> scopedFactory = Scoping.scope( key, injector, (InternalFactory<? extends T>) boundProviderFactory, source, scoping); putBinding( new LinkedProviderBindingImpl<T>( injector, key, source, scopedFactory, scoping, providerKey)); return true; }
/** * Initialize and validate everything. */ private void initializeStatically() { bindingData.initializeBindings(); stopwatch.resetAndLog("Binding initialization"); for (InjectorShell shell : shells) { shell.getInjector().index(); } stopwatch.resetAndLog("Binding indexing"); injectionRequestProcessor.process(shells); stopwatch.resetAndLog("Collecting injection requests"); bindingData.runCreationListeners(errors); stopwatch.resetAndLog("Binding validation"); injectionRequestProcessor.validate(); stopwatch.resetAndLog("Static validation"); initializer.validateOustandingInjections(errors); stopwatch.resetAndLog("Instance member validation"); new LookupProcessor(errors).process(shells); for (InjectorShell shell : shells) { ((DeferredLookups) shell.getInjector().lookups).initialize(errors); } stopwatch.resetAndLog("Provider verification"); for (InjectorShell shell : shells) { if (!shell.getElements().isEmpty()) { throw new AssertionError("Failed to execute " + shell.getElements()); } } errors.throwCreationExceptionIfErrorsExist(); }
protected void scheduleInitialization(final BindingImpl<?> binding) { bindingData.addUninitializedBinding(new Runnable() { public void run() { try { binding.getInjector().initializeBinding(binding, errors.withSource(source)); } catch (ErrorsException e) { errors.merge(e.getErrors()); } } }); } }
public InternalInjectorCreator() { injectionRequestProcessor = new InjectionRequestProcessor(errors, initializer); bindingData = new ProcessedBindingData(); }
private <T> void bindExposed(PrivateElements privateElements, Key<T> key) { ExposedKeyFactory<T> exposedKeyFactory = new ExposedKeyFactory<T>(key, privateElements); bindingData.addCreationListener(exposedKeyFactory); putBinding(new ExposedBindingImpl<T>( injector, privateElements.getExposedSource(key), key, exposedKeyFactory, privateElements)); } }