Package javax.enterprise.inject.spi

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


*/
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) {
        BeanManager beanManager = new BeanManagerLocator().getBeanManager();
        Bean<?> bean = beanManager.resolve(beanManager.getBeans(DialogueManager.class));
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

    @Override
    public Object getAsObject(FacesContext context, UIComponent component, String value) {
        BeanManager bm = getBeanManager();
        Bean<UserBean> bean = (Bean<UserBean>) bm.getBeans(UserBean.class).iterator().next();
        CreationalContext<UserBean> ctx = bm.createCreationalContext(bean);
        UserBean userBean = (UserBean) bm.getReference(bean, UserBean.class, ctx); // this could be inlined, but intentionally
                                                                                   // left this way

        for (Album a : userBean.getUser().getAlbums()) {
            if (a.getName().equals(value)) {
View Full Code Here

    @Override
    public Object getAsObject(FacesContext context, UIComponent component, String value) {
        BeanManager bm = getBeanManager();
        Bean<UserBean> bean = (Bean<UserBean>) bm.getBeans(UserBean.class).iterator().next();
        CreationalContext<UserBean> ctx = bm.createCreationalContext(bean);
        UserBean userBean = (UserBean) bm.getReference(bean, UserBean.class, ctx); // this could be inlined, but intentionally left this way


        for(Shelf s : userBean.getUser().getShelves()) {
            if (s.getName().equals(value)) {
View Full Code Here

      BeanManager manager = getBeanManager();
      Set<Bean<?>> beans = manager.getBeans(type);
      for (Bean<?> bean : beans) {
         if (bean != null)
         {
            CreationalContext<T> context = (CreationalContext<T>) manager.createCreationalContext(bean);

            if (context != null)
            {
               result.add((T) manager.getReference(bean, type, context));
               if (log.isDebugEnabled())
View Full Code Here

   public <T> void enrich(final T service)
   {
      if (service != null)
      {
         BeanManager manager = getBeanManager();
         CreationalContext<Object> context = manager.createCreationalContext(null);
         InjectionTarget<Object> injectionTarget = (InjectionTarget<Object>) manager
                  .createInjectionTarget(manager.createAnnotatedType(service.getClass()));

         injectionTarget.inject(service, context);
View Full Code Here

        }

        Bean<H> handlerBean = handlerBeans.iterator().next();

        BeanManager beanManager = BeanManagerProvider.getInstance().getBeanManager();
        CreationalContext<?> creationalContextOfHandler = beanManager.createCreationalContext(handlerBean);

        H handlerInstance = (H)beanManager.getReference(handlerBean, this.handlerClass, creationalContextOfHandler);

        if (handlerBean.getScope().equals(Dependent.class))
        {
View Full Code Here

            return null;
        }

        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

                    throw new IllegalStateException("Could not find beans for Type=" + clazz
                            + " and qualifiers:" + Arrays.toString(qualifiers));
                }

                final Bean<?> resolvedBean = bm.resolve(beans);
                final CreationalContext<?> creationalContext = bm.createCreationalContext(resolvedBean);
                instance = bm.getReference(resolvedBean, clazz, creationalContext);
                creationalContext.release();
            }
            return instance;
        }
View Full Code Here

        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());
        Assert.assertNotNull(carRepair.getCar().getUser());
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.