methodInterceptors = new HashMap<Method, List<Interceptor<?>>>();
for (Map.Entry<Method, BusinessMethodInterceptorInfo> miEntry : interceptorInfo.getBusinessMethodsInfo().entrySet())
{
Method interceptedMethod = miEntry.getKey();
BusinessMethodInterceptorInfo mii = miEntry.getValue();
List<Interceptor<?>> activeInterceptors = new ArrayList<Interceptor<?>>();
if (mii.getEjbInterceptors() != null)
{
Collections.addAll(activeInterceptors, mii.getEjbInterceptors());
}
if (mii.getCdiInterceptors() != null)
{
Collections.addAll(activeInterceptors, mii.getCdiInterceptors());
}
if (interceptorInfo.getSelfInterceptorBean() != null)
{
if (interceptedMethod.getAnnotation(AroundInvoke.class) == null) // this check is a dirty hack for now to prevent infinite loops
{
// add self-interception as last interceptor in the chain.
activeInterceptors.add(interceptorInfo.getSelfInterceptorBean());
}
}
if (activeInterceptors.size() > 0)
{
methodInterceptors.put(interceptedMethod, activeInterceptors);
}
else if (mii.getMethodDecorators() != null)
{
methodInterceptors.put(interceptedMethod, Collections.EMPTY_LIST);
}
}