Java 类com.google.inject.internal.InjectorImpl.InjectorOptions 实例源码

项目:guice    文件:ConstructionContext.java   
public Object createProxy(InjectorOptions injectorOptions, Class<?> expectedType)
    throws InternalProvisionException {
  if (injectorOptions.disableCircularProxies) {
    throw InternalProvisionException.circularDependenciesDisabled(expectedType);
  }
  if (!expectedType.isInterface()) {
    throw InternalProvisionException.cannotProxyClass(expectedType);
  }

  if (invocationHandlers == null) {
    invocationHandlers = new ArrayList<>();
  }

  DelegatingInvocationHandler<T> invocationHandler = new DelegatingInvocationHandler<>();
  invocationHandlers.add(invocationHandler);

  // TODO: if I create a proxy which implements all the interfaces of
  // the implementation type, I'll be able to get away with one proxy
  // instance (as opposed to one per caller).
  ClassLoader classLoader = BytecodeGen.getClassLoader(expectedType);
  return expectedType.cast(
      Proxy.newProxyInstance(
          classLoader,
          new Class[] {expectedType, CircularDependencyProxy.class},
          invocationHandler));
}
项目:guice    文件:InjectorOptionsProcessor.java   
InjectorOptions getOptions(Stage stage, InjectorOptions parentOptions) {
  checkNotNull(stage, "stage must be set");
  if (parentOptions == null) {
    return new InjectorOptions(
        stage,
        jitDisabled,
        disableCircularProxies,
        atInjectRequired,
        exactBindingAnnotationsRequired);
  } else {
    checkState(stage == parentOptions.stage, "child & parent stage don't match");
    return new InjectorOptions(
        stage,
        jitDisabled || parentOptions.jitDisabled,
        disableCircularProxies || parentOptions.disableCircularProxies,
        atInjectRequired || parentOptions.atInjectRequired,
        exactBindingAnnotationsRequired || parentOptions.exactBindingAnnotationsRequired);
  }
}
项目:guice-old    文件:InjectorOptionsProcessor.java   
InjectorOptions getOptions(Stage stage, InjectorOptions parentOptions) {
  checkNotNull(stage, "stage must be set");
  if(parentOptions == null) {
    return new InjectorOptions(
        stage,
        jitDisabled,
        disableCircularProxies,
        atInjectRequired,
        exactBindingAnnotationsRequired);
  } else {
    checkState(stage == parentOptions.stage, "child & parent stage don't match");
    return new InjectorOptions(
        stage,
        jitDisabled || parentOptions.jitDisabled,
        disableCircularProxies || parentOptions.disableCircularProxies,
        atInjectRequired || parentOptions.atInjectRequired,
        exactBindingAnnotationsRequired || parentOptions.exactBindingAnnotationsRequired);
  }
}
项目:google-guice    文件:InjectorOptionsProcessor.java   
InjectorOptions getOptions(Stage stage, InjectorOptions parentOptions) {
  checkNotNull(stage, "stage must be set");
  if(parentOptions == null) {
    return new InjectorOptions(
        stage,
        jitDisabled,
        disableCircularProxies,
        atInjectRequired,
        exactBindingAnnotationsRequired);
  } else {
    checkState(stage == parentOptions.stage, "child & parent stage don't match");
    return new InjectorOptions(
        stage,
        jitDisabled || parentOptions.jitDisabled,
        disableCircularProxies || parentOptions.disableCircularProxies,
        atInjectRequired || parentOptions.atInjectRequired,
        exactBindingAnnotationsRequired || parentOptions.exactBindingAnnotationsRequired);
  }
}
项目:guice    文件:InternalContext.java   
InternalContext(InjectorOptions options, Object[] toClear) {
  this.options = options;
  this.toClear = toClear;
  this.enterCount = 1;
}
项目:guice    文件:InternalContext.java   
InjectorOptions getInjectorOptions() {
  return options;
}