コード例 #1
0
  /** Inject dynamically. */
  private void injectDynamically() {
    injectionRequestProcessor.injectMembers();
    stopwatch.resetAndLog("Static member injection");

    initializer.injectAll(errors);
    stopwatch.resetAndLog("Instance injection");
    errors.throwCreationExceptionIfErrorsExist();

    for (InjectorShell shell : shells) {
      loadEagerSingletons(shell.getInjector(), stage, errors);
    }
    stopwatch.resetAndLog("Preloading singletons");
    errors.throwCreationExceptionIfErrorsExist();
  }
コード例 #2
0
ファイル: Message.java プロジェクト: dowsam/rebirth-core
 /**
  * Write replace.
  *
  * @return the object
  * @throws ObjectStreamException the object stream exception
  */
 private Object writeReplace() throws ObjectStreamException {
   Object[] sourcesAsStrings = sources.toArray();
   for (int i = 0; i < sourcesAsStrings.length; i++) {
     sourcesAsStrings[i] = Errors.convert(sourcesAsStrings[i]).toString();
   }
   return new Message(ImmutableList.copyOf(sourcesAsStrings), message, cause);
 }
コード例 #3
0
  /** Initialize statically. */
  private void initializeStatically() {
    bindingProcesor.initializeBindings();
    stopwatch.resetAndLog("Binding initialization");

    for (InjectorShell shell : shells) {
      shell.getInjector().index();
    }
    stopwatch.resetAndLog("Binding indexing");

    injectionRequestProcessor.process(shells);
    stopwatch.resetAndLog("Collecting injection requests");

    bindingProcesor.runCreationListeners();
    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();
  }
コード例 #4
0
ファイル: Message.java プロジェクト: dowsam/rebirth-core
 /* (non-Javadoc)
  * @see cn.com.rebirth.search.commons.inject.spi.Element#getSource()
  */
 public String getSource() {
   return sources.isEmpty()
       ? SourceProvider.UNKNOWN_SOURCE.toString()
       : Errors.convert(sources.get(sources.size() - 1)).toString();
 }