Package org.jboss.weld.bean.interceptor

Examples of org.jboss.weld.bean.interceptor.InterceptorBindingsAdapter


                EnhancedAnnotatedType<?> enhancedType = manager.getServices().get(ClassTransformer.class).getEnhancedAnnotatedType(type);
                InterceptionModelInitializer.of(manager, enhancedType, null).init();
            }
            InterceptionModel model = manager.getInterceptorModelRegistry().get(type);
            if (model != null) {
                return new InterceptorBindingsAdapter(manager.getInterceptorModelRegistry().get(type));
            }
        }
        return null;
    }
View Full Code Here


    }

    // @Test -- impl details class
    public void testInterceptors() throws Exception {
        SessionBean<Ball> ballSessionBean = (SessionBean<Ball>) beanManager.getBeans(Ball.class).iterator().next();
        InterceptorBindings interceptorBindings = new InterceptorBindingsAdapter(beanManager.getInterceptorModelRegistry().get(ballSessionBean.getAnnotated()));
        List<javax.enterprise.inject.spi.Interceptor> interceptors =
                new ArrayList<javax.enterprise.inject.spi.Interceptor>(interceptorBindings.getAllInterceptors());

        Assert.assertEquals(3, interceptors.size());
        List<Class<?>> expectedInterceptors = Arrays.<Class<?>>asList(Goalkeeper.class, Defender.class, Referee.class);
        Assert.assertTrue(expectedInterceptors.contains(interceptors.get(0).getBeanClass()));
        Assert.assertTrue(expectedInterceptors.contains(interceptors.get(1).getBeanClass()));
        Assert.assertTrue(expectedInterceptors.contains(interceptors.get(2).getBeanClass()));


        Assert.assertEquals(0, interceptorBindings.getMethodInterceptors(InterceptionType.AROUND_TIMEOUT, ballSessionBean.getType().getMethod("shoot")).size());
        Assert.assertEquals(1, interceptorBindings.getMethodInterceptors(InterceptionType.AROUND_INVOKE, ballSessionBean.getType().getMethod("shoot")).size());
        Assert.assertEquals(Goalkeeper.class, interceptorBindings.getMethodInterceptors(InterceptionType.AROUND_INVOKE, ballSessionBean.getType().getMethod("shoot")).get(0).getBeanClass());

        Assert.assertEquals(0, interceptorBindings.getMethodInterceptors(InterceptionType.AROUND_TIMEOUT, ballSessionBean.getType().getMethod("pass")).size());
        Assert.assertEquals(1, interceptorBindings.getMethodInterceptors(InterceptionType.AROUND_INVOKE, ballSessionBean.getType().getMethod("pass")).size());
        Assert.assertEquals(Defender.class, interceptorBindings.getMethodInterceptors(InterceptionType.AROUND_INVOKE, ballSessionBean.getType().getMethod("pass")).get(0).getBeanClass());

        Method finishGameMethod = ballSessionBean.getType().getMethod("finishGame", Timer.class);
        Assert.assertEquals(0, interceptorBindings.getMethodInterceptors(InterceptionType.AROUND_INVOKE, finishGameMethod).size());
        Assert.assertEquals(1, interceptorBindings.getMethodInterceptors(InterceptionType.AROUND_TIMEOUT, finishGameMethod).size());
        Assert.assertEquals(Referee.class, interceptorBindings.getMethodInterceptors(InterceptionType.AROUND_TIMEOUT, finishGameMethod).get(0).getBeanClass());
    }
View Full Code Here

    }

    protected void registerInterceptors() {
        InterceptionModel model = beanManager.getInterceptorModelRegistry().get(getAnnotated());
        if (model != null) {
            getBeanManager().getServices().get(EjbServices.class).registerInterceptors(getEjbDescriptor(), new InterceptorBindingsAdapter(model));
        }
    }
View Full Code Here

                if (!getManager().getInterceptorModelRegistry().containsKey(type.slim())) {
                    InterceptionModelInitializer.of(getManager(), type, null).init();
                }
                InterceptionModel model = getManager().getInterceptorModelRegistry().get(type.slim());
                if (model != null) {
                    ejbServices.registerInterceptors(descriptor, new InterceptorBindingsAdapter(model));
                }
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.jboss.weld.bean.interceptor.InterceptorBindingsAdapter

Copyright © 2018 www.massapicom. 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.