Package javax.enterprise.inject.spi

Examples of javax.enterprise.inject.spi.InjectionTarget


    @SuppressWarnings("unchecked")
    public Object buildBean(String className, Map<String, Object> extraContext, boolean injectInternal)
            throws Exception {

        Class<?> clazz = getClassInstance(className);
        InjectionTarget injectionTarget = getInjectionTarget(clazz);

        Object o = injectionTarget.produce(ctx);
        injectionTarget.inject(o, ctx);
        injectionTarget.postConstruct(o);

        if (injectInternal) {
            injectInternalBeans(o);
        }
View Full Code Here


        return path;
    }

    @SuppressWarnings({"unchecked"})
    protected void doInitialize(ServletContext context) {
        InjectionTarget it = manager.createInjectionTarget(manager.createAnnotatedType(getHandlerClass()));
        CreationalContext cc = manager.createCreationalContext(null);
        handler = (RequestHandler) it.produce(cc);
        it.inject(handler, cc);

        handler.initialize(context);
    }
View Full Code Here

    private class EnhancedDTOModelFactory extends DefaultDTOModelFactory {
        @SuppressWarnings({"unchecked"})
        @Override
        protected <E extends Serializable> DTOModel createModelInternal(Class<E> clazz) {
            DTOModel model = super.createModelInternal(clazz);
            InjectionTarget it = beanManager.createInjectionTarget(beanManager.createAnnotatedType(model.getClass()));
            CreationalContext<RequestHandler> cc = beanManager.createCreationalContext(null);
            it.inject(model, cc);
            return model;
        }
View Full Code Here

        WeldContainer wc = getWeldContainer();
        if (wc != null) {
            BeanManager beanManager = wc.getBeanManager();

            AnnotatedType annotatedType = beanManager.createAnnotatedType(managedClass);
            InjectionTarget target = beanManager.createInjectionTarget(annotatedType);

            CreationalContext cc = beanManager.createCreationalContext(null);

            target.inject(managedObject, cc);

            if( invokePostConstruct ) {
                target.postConstruct(managedObject);
            }

            context = new JCDIInjectionContextImpl(target, cc, managedObject);
        }
View Full Code Here

        if (wc != null) {
            BeanManager beanManager = wc.getBeanManager();

            AnnotatedType annotatedType = beanManager.createAnnotatedType(managedObject.getClass());
            InjectionTarget target = beanManager.createInjectionTarget(annotatedType);

            CreationalContext cc = beanManager.createCreationalContext(null);

            target.inject(managedObject, cc);
        }
    }
View Full Code Here

        WeldContainer wc = getWeldContainer();
        if (wc != null) {
            BeanManager beanManager = wc.getBeanManager();

            AnnotatedType annotatedType = beanManager.createAnnotatedType(interceptorClass);
            InjectionTarget target =
                ((WeldManager) beanManager).getInjectionTargetFactory(annotatedType).createInterceptorInjectionTarget();

            CreationalContext cc = beanManager.createCreationalContext(null);

            interceptorInstance = (T) target.produce(cc);
            target.inject(interceptorInstance, cc);
        }

        return interceptorInstance;
    }
View Full Code Here

                }
                webBeansContext.getWebBeansUtil().defineManagedBean(managedBeanCreator, processInjectionTargetEvent, false);
            }

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

            Collection deployments = deploymentImpl.getBeanDeploymentArchives();
            BeanDeploymentArchive beanDeploymentArchive = (BeanDeploymentArchive)deployments.iterator().next();
            BeanManager beanManager = weldBootstrap.getManager(beanDeploymentArchive);
            // PENDING : Not available in this Web Beans Release
            CreationalContext ccontext = beanManager.createCreationalContext(null);
            InjectionTarget injectionTarget = beanManager.createInjectionTarget(beanManager.createAnnotatedType(webComponent.getClass()));
            injectionTarget.inject(webComponent, ccontext);

        }
    }
View Full Code Here

        // Get an the Bean object
        Bean<?> bean = weldManager.getBean(ejbDesc);

        // Create the injection target
        InjectionTarget it = weldManager.createInjectionTarget(ejbDesc);

        // Per instance required, create the creational context
        CreationalContext<?> cc = weldManager.createCreationalContext(bean);  
 
      Object beanInstance = instance;
   
      if( beanInstance == null ) {
          // Create instance , perform constructor injection.
          beanInstance = it.produce(cc);
      }

      // Injection is not performed yet. Separate injectEJBInstance() call is required.
        return new JCDIInjectionContextImpl(it, cc, beanInstance);
View Full Code Here

        BeanDeploymentArchive bda = weldDeployer.getBeanDeploymentArchiveForBundle(topLevelBundleDesc);
        //BeanDeploymentArchive bda = getBDAForBeanClass(topLevelBundleDesc, managedObject.getClass().getName());
        WeldBootstrap bootstrap = weldDeployer.getBootstrapForApp(bundle.getApplication());
        BeanManager beanManager = bootstrap.getManager(bda);
        AnnotatedType annotatedType = beanManager.createAnnotatedType(managedObject.getClass());
        InjectionTarget it = beanManager.createInjectionTarget(annotatedType);
        CreationalContext cc = beanManager.createCreationalContext(null);
        it.inject(managedObject, cc);
    }
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.