Package javax.enterprise.inject.spi

Examples of javax.enterprise.inject.spi.BeanManager.createCreationalContext()


        Iterator<Decorator<?>> itList = decoratorList.iterator();
        BeanManager manager = BeanManagerImpl.getManager();
        while (itList.hasNext())
        {
            WebBeansDecorator<Object> decorator = (WebBeansDecorator<Object>) itList.next();
            CreationalContext<Object> creationalContext = manager.createCreationalContext(decorator);
            Object decoratorInstance = manager.getReference(decorator, decorator.getBeanClass(), creationalContext);
           
            decorator.setInjections(decoratorInstance, creationalContext);
            decorator.setDelegate(decoratorInstance, delegate);
            decoratorStack.add(decoratorInstance);
View Full Code Here


        BeanManager bm = getLifecycle().getBeanManager();
        Set<Bean<?>> beans = getLifecycle().getBeanManager().getBeans(PersonalDataBean.class);
        Assert.assertNotNull(beans);
        Assert.assertTrue(beans.size() == 1);
        Bean pdbBean = beans.iterator().next();
        CreationalContext<PersonalDataBean> pdbCreational = bm.createCreationalContext(pdbBean);
        Assert.assertNotNull(pdbCreational);

        // oki, now let's serializeBean the CreationalContext
        byte[] serial = serializeCreationalContext(pdbCreational);
        CreationalContext<?> cc2 = deSerializeCreationalContext(serial);
View Full Code Here

        startContainer(classes);
       
        BeanManager manager = getBeanManager();
        Bean<?> subClassBean = manager.getBeans(SubClassInheritedBean.class, new Annotation[0]).iterator().next();
       
        Object subClassInstance = manager.getReference(subClassBean, SubClassInheritedBean.class, manager.createCreationalContext(subClassBean));
       
        Assert.assertTrue(subClassInstance instanceof SubClassInheritedBean);
        SubClassInheritedBean beanInstance = (SubClassInheritedBean)subClassInstance;
        beanInstance.business();
               
View Full Code Here

        startContainer(classes);
       
        BeanManager manager = getBeanManager();
        Bean<?> subClassBean = manager.getBeans(SubClassBean.class, new Annotation[0]).iterator().next();
       
        Object subClassInstance = manager.getReference(subClassBean, SubClassBean.class, manager.createCreationalContext(subClassBean));
       
        Assert.assertTrue(subClassInstance instanceof SubClassBean);
        SubClassBean beanInstance = (SubClassBean)subClassInstance;
        beanInstance.business();
       
View Full Code Here

    @SuppressWarnings("unchecked")
    public Conversation getConversationBeanReference()
    {
      BeanManager beanManager = BeanManagerImpl.getManager();
        Bean<Conversation> bean = (Bean<Conversation>)beanManager.getBeans(Conversation.class, new DefaultLiteral()).iterator().next();
        Conversation conversation =(Conversation) beanManager.getReference(bean, Conversation.class, beanManager.createCreationalContext(bean));

        return conversation;
    }

    /**
 
View Full Code Here

   protected ExecutionHandler getExecutionHandler()
   {
      BeanManager beanManager = getBeanManager(getServletConfig().getServletContext());
      Bean<ExecutionHandler> bean = (Bean<ExecutionHandler>) beanManager.getBeans(
            ExecutionHandler.class).iterator().next();
      return bean.create(beanManager.createCreationalContext(bean));
   }
  
   @SuppressWarnings("unchecked")
   @Override
   protected InterfaceGenerator getInterfaceHandler()
View Full Code Here

   protected InterfaceGenerator getInterfaceHandler()
   {
      BeanManager beanManager = getBeanManager(getServletConfig().getServletContext());
      Bean<InterfaceGenerator> bean = (Bean<InterfaceGenerator>) beanManager.getBeans(
            InterfaceGenerator.class).iterator().next();
      return bean.create(beanManager.createCreationalContext(bean));
   }
  
   @SuppressWarnings("unchecked")
   @Override
   protected ModelHandler getModelHandler()
View Full Code Here

   protected ModelHandler getModelHandler()
   {
      BeanManager beanManager = getBeanManager(getServletConfig().getServletContext());
      Bean<ModelHandler> bean = (Bean<ModelHandler>) beanManager.getBeans(
            ModelHandler.class).iterator().next();
      return bean.create(beanManager.createCreationalContext(bean));
   }
}
View Full Code Here

        final BeanManager beanManager = this.beanManager.getValue();
        final InjectionTarget injectionTarget = getInjectionTarget(clazz);
        return new ManagedReferenceFactory() {
            @Override
            public ManagedReference getReference() {
                final CreationalContext context = beanManager.createCreationalContext(null);
                final Object instance = injectionTarget.produce(context);
                injectionTarget.inject(instance, context);
                injectionTarget.postConstruct(instance);
                return new WeldManagedReference(injectionTarget, context, instance);
            }
View Full Code Here

    @Override
    public ManagedReference createInstance(final Object instance) {
        final BeanManager beanManager = this.beanManager.getValue();
        final InjectionTarget injectionTarget = getInjectionTarget(instance.getClass());
        final CreationalContext context = beanManager.createCreationalContext(null);
        injectionTarget.inject(instance, context);
        injectionTarget.postConstruct(instance);
        return new WeldManagedReference(injectionTarget, context, instance);
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.