Examples of createCreationalContext()


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

                return type.cast(o);
            }
        }
        // Get the first bean found that implements the given type.
        Bean bean = beans.iterator().next();
        CreationalContext ctx = bm.createCreationalContext(bean);
        Object o = bm.getReference(bean, bean.getBeanClass(), ctx);
        return type.cast(o);
    }

    public static Object getBeanByType(String type) {
View Full Code Here

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

            Set<Bean<?>> beans = manager.getBeans(clazz);

            for (Bean<?> bean : beans) {

                CreationalContext<?> cc = manager.createCreationalContext(bean);

                Object reference = manager.getReference(bean, clazz, cc);
                result.add((T) reference);

            }
View Full Code Here

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

  public ErraiService locateService() {
    BeanManager beanManager = Util.lookupBeanManager();

    Set<Bean<?>> beans = beanManager.getBeans(ErraiService.class);
    Bean<?> bean = beanManager.resolve(beans);
    CreationalContext<?> context = beanManager.createCreationalContext(bean);

    return (ErraiService) beanManager.getReference(bean, ErraiService.class, context);

  }
}
View Full Code Here

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

    }

    public static Object getBeanByName(String name) {
        BeanManager bm = getBeanManager();
        Bean bean = bm.getBeans(name).iterator().next();
        CreationalContext ctx = bm.createCreationalContext(bean);
        Object o = bm.getReference(bean, bean.getBeanClass(), ctx);
        return o;
    }

    public static Object getBeanByType(Class type) {
View Full Code Here

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

    }

    public static Object getBeanByType(Class type) {
        BeanManager bm = getBeanManager();
        Bean bean = bm.getBeans(type).iterator().next();
        CreationalContext ctx = bm.createCreationalContext(bean);
        Object o = bm.getReference(bean, bean.getBeanClass(), ctx);
        return o;
    }   
}
View Full Code Here

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

                    {
                        if(parameter.getBaseType().equals(InjectionPoint.class))
                        {
                            BeanManager manager = injectionOwnerBean.getWebBeansContext().getBeanManagerImpl();
                            Bean<?> injectionPointBean = manager.getBeans(InjectionPoint.class, new DefaultLiteral()).iterator().next();
                            Object reference = manager.getReference(injectionPointBean, InjectionPoint.class, manager.createCreationalContext(injectionPointBean));

                            dependentParameters.put(injectionPointBean, reference);
                            list.add(reference);
                           
                            injectionPoint = true;
View Full Code Here

Examples of org.apache.webbeans.container.BeanManagerImpl.createCreationalContext()

                if (ifExist && object == null)
                {
                    return;
                }

                creationalContext = manager.createCreationalContext(component);

                if (isPrivateMethod)
                {
                    // since private methods cannot be intercepted, we can just call them directly
                    // so we get the contextual instance directly from the context because we do not
View Full Code Here

Examples of org.jboss.weld.manager.BeanManagerImpl.createCreationalContext()

            //we just look up the service rather than using a dependency
            //the component itself has a dependency on this service, which means that it has to be up
            final WeldContainer weldContainer = (WeldContainer) CurrentServiceContainer.getServiceContainer().getRequiredService(weldContainerServiceName).getValue();
            final BeanManagerImpl beanManager = (BeanManagerImpl) weldContainer.getBeanManager();
            final Bean<?> bean = beanManager.resolve(beanManager.getBeans(EjbRequestContext.class, EjbLiteral.INSTANCE));
            final CreationalContext<?> ctx = beanManager.createCreationalContext(bean);
            requestContext = (EjbRequestContext) beanManager.getReference(bean, EjbRequestContext.class, ctx);
        }
        try {
            requestContext.associate(context.getInvocationContext());
            requestContext.activate();
View Full Code Here

Examples of org.jboss.weld.manager.BeanManagerImpl.createCreationalContext()

            //we just look up the service rather than using a dependency
            //the component itself has a dependency on this service, which means that it has to be up
            final WeldContainer weldContainer = (WeldContainer) CurrentServiceContainer.getServiceContainer().getRequiredService(weldContainerServiceName).getValue();
            final BeanManagerImpl beanManager = (BeanManagerImpl) weldContainer.getBeanManager();
            final Bean<?> bean = beanManager.resolve(beanManager.getBeans(EjbRequestContext.class, EjbLiteral.INSTANCE));
            final CreationalContext<?> ctx = beanManager.createCreationalContext(bean);
            requestContext = (EjbRequestContext) beanManager.getReference(bean, EjbRequestContext.class, ctx);
        }
        try {
            requestContext.associate(context.getInvocationContext());
            requestContext.activate();
View Full Code Here

Examples of org.jboss.weld.manager.api.WeldManager.createCreationalContext()

      EjbDescriptor<Object> ejbDescriptor = weldManager.getEjbDescriptor(enterpriseBeanMetaData.getEjbName());
      if (ejbDescriptor.getBeanClass().equals(clazz))
      {
         SessionBean<Object> bean = (SessionBean) weldManager.getBean(ejbDescriptor);
         InjectionTarget<Object> injectionTarget = weldManager.createInjectionTarget(ejbDescriptor);
         CreationalContext<Object> creationalContext = weldManager.createCreationalContext(bean);
         T instance = (T) injectionTarget.produce(creationalContext);
         return instance;
      }
      else
      {
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.