Package javax.enterprise.inject.spi

Examples of javax.enterprise.inject.spi.InjectionTarget


      /*
      Protocol protocol
        = (Protocol) webBeans.createTransientObjectNoInit(_protocolClass);
      */
      InjectionTarget target = webBeans.createInjectionTarget(_protocolClass);
      CreationalContext env = webBeans.createCreationalContext(null);

      AbstractProtocol protocol = (AbstractProtocol) target.produce(env);
      target.inject(protocol, env);

      if (_init != null)
        _init.configure(protocol);

      target.postConstruct(protocol);

      setProtocol(protocol);
    }
    else
      throw new ConfigException(L.l("protocol requires either a class"));
View Full Code Here


      if (_authenticator != null)
        login.setAuthenticator(_authenticator);

      InjectManager manager = InjectManager.create();
      InjectionTarget inject = manager.createInjectionTarget(login.getClass());
      inject.inject(login, manager.createCreationalContext(null));

      login.init();

      return login;
    } catch (Exception e) {
View Full Code Here

    /**
     * Lets perform injection of all beans which use Camel annotations
     */
    public void onInjectionTarget(@Observes ProcessInjectionTarget<?> event) {
        final InjectionTarget injectionTarget = event.getInjectionTarget();
        AnnotatedType annotatedType = event.getAnnotatedType();
        final Class<Object> beanClass = annotatedType.getJavaClass();
        // TODO this is a bit of a hack - what should the bean name be?
        final String beanName = injectionTarget.toString();
        ContextName contextName = annotatedType.getAnnotation(ContextName.class);
        final BeanAdapter adapter = createBeanAdapter(beanClass, contextName);
        if (!adapter.isEmpty()) {
            DelegateInjectionTarget newTarget = new DelegateInjectionTarget(injectionTarget) {

View Full Code Here

            InjectionTarget<?> injectionTarget = getBeanManager().createInjectionTarget(builder.create());
            injectionTargets.put(entity.getClass(), injectionTarget);
            log.infov("Enabling injection into entity {}", entity.getClass());
         }
      }
      InjectionTarget it = injectionTargets.get(entity.getClass());
      if (it != NULL_INJECTION_TARGET)
      {
         log.debugv("Running CDI injection for {}", entity.getClass());
         it.inject(entity, new CreationalContextImpl());
      }

   }
View Full Code Here

        BeanManager beanManager = getBeanManager();

        CreationalContext creationalContext = beanManager.createCreationalContext(null);

        AnnotatedType annotatedType = beanManager.createAnnotatedType(instance.getClass());
        InjectionTarget injectionTarget = beanManager.createInjectionTarget(annotatedType);
        injectionTarget.inject(instance, creationalContext);
        return instance;
    }
View Full Code Here

    private <T> T tryToInjectFields(T instance)
    {
        CreationalContext creationalContext = beanManager.createCreationalContext(null);

        AnnotatedType annotatedType = beanManager.createAnnotatedType(instance.getClass());
        InjectionTarget injectionTarget = beanManager.createInjectionTarget(annotatedType);
        injectionTarget.inject(instance, creationalContext);
        return instance;
    }
View Full Code Here

        InjectableConstructor constructor = null;
        if (injectConstructor != null) {
            constructor = new InjectableConstructor(injectConstructor, beanManager, bean);
        }

        final InjectionTarget injectionTarget;
        if (bean instanceof AbstractClassBean) {
            //if we have the bean object we just use the CDI injectionTarget

            injectionTarget = ((AbstractClassBean) bean).getInjectionTarget();
        } else {
View Full Code Here

    {
        BeanManager beanManager = getBeanManager();
        CreationalContext creationalContext = beanManager.createCreationalContext(null);

        AnnotatedType annotatedType = beanManager.createAnnotatedType(instance.getClass());
        InjectionTarget injectionTarget = beanManager.createInjectionTarget(annotatedType);
        injectionTarget.inject(instance, creationalContext);
        return instance;
    }
View Full Code Here

            if(processInjectionTarget != null)
            {
                if(processInjectionTargetEvent != null)
                {
                    final InjectionTarget originalInjectionTarget = processInjectionTargetEvent.getInjectionTarget();
                    final InjectionTarget updatedInjectionTarget = webBeansContext.getWebBeansUtil()
                            .fireProcessInjectionTargetEvent(processInjectionTarget).getInjectionTarget();
                    if (updatedInjectionTarget != originalInjectionTarget)
                    {
                        webBeansContext.getBeanManagerImpl().putInjectionTargetWrapper(managedBean, new InjectionTargetWrapper<T>(updatedInjectionTarget));
                    }
View Full Code Here

      page._caucho_isModified();

      try {
        InjectManager beanManager = InjectManager.create();
       
        InjectionTarget inject = beanManager.createInjectionTarget(page.getClass());

        CreationalContext<?> env = new OwnerCreationalContext(null);

        inject.inject(page, env);
       
        inject.postConstruct(page);
      } catch (InjectionException e) {
        throw ConfigException.createConfig(e);
      } catch (RuntimeException e) {
        throw e;
      } catch (Exception e) {
View Full Code Here

TOP

Related Classes of javax.enterprise.inject.spi.InjectionTarget

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.