Package javax.enterprise.inject.spi

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


                bm = null;
                bean = null;
            } else {
                bm = wc.getBeanManagerImpl();
                final Set<Bean<?>> beans = bm.getBeans(clazz);
                bean = bm.resolve(beans);
            }

            // create the MBean instance with cdi if possible or manually otherwise
            final Object instance;
            final CreationalContext creationalContext;
View Full Code Here


public class DialogueBeanProvider
{
   public static Dialogue dialogue(ServletContext servletContext)
   {
      BeanManager beanManager = new BeanManagerLocator().getBeanManager();
      Bean<?> bean = beanManager.resolve(beanManager.getBeans(Dialogue.class));
      return (Dialogue) beanManager.getReference(bean, Dialogue.class, beanManager.createCreationalContext(bean));
   }

   public static DialogueManager dialogueManager(ServletContext servletContext)
   {
View Full Code Here

   }

   public static DialogueManager dialogueManager(ServletContext servletContext)
   {
      BeanManager beanManager = new BeanManagerLocator().getBeanManager();
      Bean<?> bean = beanManager.resolve(beanManager.getBeans(DialogueManager.class));
      return (DialogueManager) beanManager.getReference(bean, DialogueManager.class, beanManager.createCreationalContext(bean));
   }
}
View Full Code Here

    Set<Bean<?>> beans = beanManager.getBeans(name);

    if (beans.size() == 0)
      return null;

    Bean<?> bean = beanManager.resolve(beans);
    CreationalContext<?> env = beanManager.createCreationalContext(bean);

    return beanManager.getReference(bean, bean.getBeanClass(), env);
  }
 
View Full Code Here

      Set<Bean<?>> beans = beanManager.getBeans(key);

      //The given type is a CDI bean, so the container will deal with injection etc.
      if (!beans.isEmpty())
      {
         Bean<?> bean = beanManager.resolve(beans);
         CreationalContext<?> ctx = beanManager.createCreationalContext(bean);
    
         theValue = (T) beanManager.getReference(bean, key, ctx);
      }
      //The given type is no CDI bean, so delegate the creation to the default factory
View Full Code Here

        BeanManager bm = cc.getBeanManager();
        Assert.assertNotNull(bm);
       
        Set<Bean<?>> beans = bm.getBeans(CarRepair.class);
        Bean<?> bean = bm.resolve(beans);
       
        CarRepair carRepair = (CarRepair) bm.getReference(bean, CarRepair.class, bm.createCreationalContext(bean));
        Assert.assertNotNull(carRepair);

        Assert.assertNotNull(carRepair.getCar());
View Full Code Here

        BeanManager bm = cc.getBeanManager();
        Assert.assertNotNull(bm);

        Set<Bean<?>> beans = bm.getBeans(CarRepair.class);
        Bean<?> bean = bm.resolve(beans);

        CarRepair carRepair = (CarRepair) bm.getReference(bean, CarRepair.class, bm.createCreationalContext(bean));
        Assert.assertNotNull(carRepair);

        Assert.assertNotNull(carRepair.getCar());
View Full Code Here

        BeanManager beanManager = cdiContainer.getBeanManager();
        Assert.assertNotNull(beanManager);

        Set<Bean<?>> beans = beanManager.getBeans(CarRepair.class);
        Bean<?> bean = beanManager.resolve(beans);

        CarRepair carRepair = (CarRepair)
            beanManager.getReference(bean, CarRepair.class, beanManager.createCreationalContext(bean));

        Assert.assertNotNull(carRepair);
View Full Code Here

        // now do some randmo stuff
        BeanManager beanManager = cdiContainer.getBeanManager();
        Assert.assertNotNull(beanManager);

        Set<Bean<?>> beans = beanManager.getBeans(CarRepair.class);
        Bean<?> bean = beanManager.resolve(beans);

        CarRepair carRepair = (CarRepair)
                beanManager.getReference(bean, CarRepair.class, beanManager.createCreationalContext(bean));

        Assert.assertNotNull(carRepair);
View Full Code Here

            result = super.createTest();
            BeanProvider.injectFields(result); //fallback to simple injection
        }
        else
        {
            Bean<Object> bean = (Bean<Object>) beanManager.resolve(beans);
            CreationalContext<Object> creationalContext = beanManager.createCreationalContext(bean);
            result = beanManager.getReference(bean, type, creationalContext);
        }
        return result;
    }
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.