Package javax.enterprise.inject.spi

Examples of javax.enterprise.inject.spi.Bean.create()


    @SuppressWarnings({ "unchecked", "rawtypes" })
    public void testLifecycleInterceptor() {

        Bean bean = beanManager.getBeans(Marathon.class).iterator().next();
        CreationalContext creationalContext = beanManager.createCreationalContext(bean);
        Marathon marathon = (Marathon) bean.create(creationalContext);

        assertTrue(LifecycleInterceptor.isPostConstructCalled());
        assertEquals(marathon.getLength(), 42);
        bean.destroy(marathon, creationalContext);
        assertTrue(LifecycleInterceptor.isPreDestroyCalled());
View Full Code Here


    @SuppressWarnings({ "unchecked", "rawtypes" })
    public void testLifecycleInterceptor() {

        Bean bean = beanManager.getBeans(Marathon.class).iterator().next();
        CreationalContext creationalContext = beanManager.createCreationalContext(bean);
        Marathon marathon = (Marathon) bean.create(creationalContext);

        assertTrue(LifecycleInterceptor.isPostConstructCalled());
        assertEquals(marathon.getLength(), 42);
        bean.destroy(marathon, creationalContext);
        assertTrue(LifecycleInterceptor.isPreDestroyCalled());
View Full Code Here

     * @param beanManager the CDI bean manager that should be used to look up the type.
     * @return Object an instance of the target class.
     */
    public Object createController(Class<?> targetClass, BeanManager beanManager) {
        Bean next = beanManager.getBeans(targetClass).iterator().next();
        return next.create(beanManager.createCreationalContext(next));
    }
}
View Full Code Here

     * @param beanManager the CDI bean manager that should be used to look up the type.
     * @return Object an instance of the target class.
     */
    public Object createController(Class<?> targetClass, BeanManager beanManager) {
        Bean next = beanManager.getBeans(targetClass).iterator().next();
        return next.create(beanManager.createCreationalContext(next));
    }
}
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.