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); }
public <T> T getInterceptorInstance(InterceptorMetadata<T> interceptorMetadata) { return cast(interceptorInstances.get(interceptorMetadata.getInterceptorClass().getJavaClass())); }