public AsyncContextualProviderInjector(
      final MetaClass type, final MetaClass providerType, final InjectionContext context) {
    super(type, context);
    this.providerInjector = context.getInjectorFactory().getTypeInjector(providerType, context);
    context.registerInjector(providerInjector);

    this.testMock = context.isElementType(WiringElementType.TestMockBean, providerType);
    this.singleton = context.isElementType(WiringElementType.SingletonBean, providerType);
    this.alternative = context.isElementType(WiringElementType.AlternativeBean, providerType);

    setRendered(true);
  }
예제 #2
0
 @Override
 public void configure(
     IOCProcessingContext context,
     InjectionContext injectionContext,
     IOCConfigProcessor procFactory) {
   injectionContext.mapElementType(WiringElementType.DependentBean, FoobieScope.class);
 }
  public void registerWithBeanManager(InjectionContext context, Statement valueRef) {
    if (InjectUtil.checkIfTypeNeedsAddingToBeanStore(context, this)) {
      QualifyingMetadata md = delegate.getQualifyingMetadata();
      if (md == null) {
        md = context.getProcessingContext().getQualifyingMetadataFactory().createDefaultMetadata();
      }

      context
          .getProcessingContext()
          .appendToEnd(
              Stmt.loadVariable(context.getProcessingContext().getContextVariableReference())
                  .invoke(
                      "addBean",
                      type,
                      Refs.get(delegate.getCreationalCallbackVarName()),
                      isSingleton() ? valueRef : null,
                      md.render()));
    }
  }
예제 #4
0
  public void registerWithBeanManager(InjectionContext context, Statement valueRef) {
    if (InjectUtil.checkIfTypeNeedsAddingToBeanStore(context, this)) {
      _registerCache = new RegisterCache(context, valueRef);

      context
          .getProcessingContext()
          .appendToEnd(
              loadVariable(context.getProcessingContext().getContextVariableReference())
                  .invoke(
                      "addBean",
                      getInjectedType(),
                      Refs.get(getCreationalCallbackVarName()),
                      isSingleton() ? valueRef : null,
                      qualifyingMetadata.render()));

      for (RegistrationHook hook : registrationHooks) {
        hook.onRegister(context, valueRef);
      }
    }
  }