Ejemplo n.º 1
0
 private static Map<Class<?>, Object> initInterceptorInstanceMap(
     InterceptionModel<?> model,
     CreationalContext ctx,
     BeanManagerImpl manager,
     Set<InterceptionType> interceptionTypes) {
   Map<Class<?>, Object> interceptorInstances = new HashMap<Class<?>, Object>();
   for (InterceptorMetadata<?> interceptor : model.getAllInterceptors()) {
     for (InterceptionType interceptionType : interceptionTypes) {
       if (interceptor.isEligible(interceptionType)) {
         interceptorInstances.put(
             interceptor.getInterceptorClass().getJavaClass(),
             interceptor.getInterceptorFactory().create(ctx, manager));
       }
     }
   }
   return immutableMap(interceptorInstances);
 }
Ejemplo n.º 2
0
 public <T> T getInterceptorInstance(InterceptorMetadata<T> interceptorMetadata) {
   return cast(interceptorInstances.get(interceptorMetadata.getInterceptorClass().getJavaClass()));
 }