Java 类com.google.inject.throwingproviders.ThrowingProviderBinder.SecondaryBinder 实例源码

项目:guice    文件:CheckedProviderMethod.java   
void configure(Binder binder) {
  binder = binder.withSource(method);

  SecondaryBinder<?, ?> sbinder =
      ThrowingProviderBinder.create(binder).bind(checkedProvider, key.getTypeLiteral());
  if (key.getAnnotation() != null) {
    sbinder = sbinder.annotatedWith(key.getAnnotation());
  } else if (key.getAnnotationType() != null) {
    sbinder = sbinder.annotatedWith(key.getAnnotationType());
  }
  sbinder.scopeExceptions(scopeExceptions);
  ScopedBindingBuilder sbbuilder = sbinder.toProviderMethod(this);
  if (scopeAnnotation != null) {
    sbbuilder.in(scopeAnnotation);
  }

  if (exposed) {
    // the cast is safe 'cause the only binder we have implements PrivateBinder. If there's a
    // misplaced @Exposed, calling this will add an error to the binder's error queue
    ((PrivateBinder) binder).expose(sbinder.getKey());
  }

  CheckedProvideUtils.validateExceptions(
      binder, exceptionTypes, sbinder.getExceptionTypes(), checkedProvider);
}
项目:guice-old    文件:CheckedProviderMethod.java   
void configure(Binder binder) {
  binder = binder.withSource(method);

  SecondaryBinder<?, ?> sbinder = 
    ThrowingProviderBinder.create(binder)
      .bind(checkedProvider, key.getTypeLiteral());
  if(key.getAnnotation() != null) {
    sbinder = sbinder.annotatedWith(key.getAnnotation());
  } else if(key.getAnnotationType() != null) {
    sbinder = sbinder.annotatedWith(key.getAnnotationType());
  } 
  ScopedBindingBuilder sbbuilder = sbinder.toProviderMethod(this);
  if(scopeAnnotation != null) {
    sbbuilder.in(scopeAnnotation);
  }

  if (exposed) {
    // the cast is safe 'cause the only binder we have implements PrivateBinder. If there's a
    // misplaced @Exposed, calling this will add an error to the binder's error queue
    ((PrivateBinder) binder).expose(sbinder.getKey());
  }

  CheckedProvideUtils.validateExceptions(
      binder, exceptionTypes, sbinder.getExceptionTypes(), checkedProvider);
}
项目:google-guice    文件:CheckedProviderMethod.java   
void configure(Binder binder) {
  binder = binder.withSource(method);

  SecondaryBinder<?, ?> sbinder = 
    ThrowingProviderBinder.create(binder)
      .bind(checkedProvider, key.getTypeLiteral());
  if(key.getAnnotation() != null) {
    sbinder = sbinder.annotatedWith(key.getAnnotation());
  } else if(key.getAnnotationType() != null) {
    sbinder = sbinder.annotatedWith(key.getAnnotationType());
  } 
  ScopedBindingBuilder sbbuilder = sbinder.toProviderMethod(this);
  if(scopeAnnotation != null) {
    sbbuilder.in(scopeAnnotation);
  }

  if (exposed) {
    // the cast is safe 'cause the only binder we have implements PrivateBinder. If there's a
    // misplaced @Exposed, calling this will add an error to the binder's error queue
    ((PrivateBinder) binder).expose(sbinder.getKey());
  }

  CheckedProvideUtils.validateExceptions(
      binder, exceptionTypes, sbinder.getExceptionTypes(), checkedProvider);
}