// lets reverse the list so we apply the inner interceptors first
Collections.reverse(list);
Set<Processor> interceptors = new HashSet<Processor>();
interceptors.add(target);
for (InterceptorType interceptorType : list) {
DelegateProcessor interceptor = interceptorType.createInterceptor(routeContext);
if (!interceptors.contains(interceptor)) {
interceptors.add(interceptor);
if (interceptor.getProcessor() != null) {
LOG.warn("Interceptor " + interceptor + " currently wraps target "
+ interceptor.getProcessor()
+ " is attempting to change target " + target
+ " new wrapping has been denied.");
} else {
interceptor.setProcessor(target);
target = interceptor;
}
}
}
return target;