private static List<InterceptorMethodInvocation> buildInterceptorMethodInvocations( Object instance, Method method, Object[] args, InterceptionType interceptionType, InterceptionContext ctx) { List<? extends InterceptorClassMetadata<?>> interceptorList = ctx.getInterceptionModel().getInterceptors(interceptionType, method); List<InterceptorMethodInvocation> interceptorInvocations = new ArrayList<InterceptorMethodInvocation>(interceptorList.size()); for (InterceptorClassMetadata<?> interceptorMetadata : interceptorList) { interceptorInvocations.addAll( interceptorMetadata .getInterceptorInvocation( ctx.getInterceptorInstance(interceptorMetadata), interceptionType) .getInterceptorMethodInvocations()); } TargetClassInterceptorMetadata targetClassInterceptorMetadata = ctx.getInterceptionModel().getTargetClassInterceptorMetadata(); if (targetClassInterceptorMetadata != null && targetClassInterceptorMetadata.isEligible(interceptionType)) { interceptorInvocations.addAll( targetClassInterceptorMetadata .getInterceptorInvocation(instance, interceptionType) .getInterceptorMethodInvocations()); } return interceptorInvocations; }
private static List<InterceptorMethodInvocation> buildInterceptorMethodInvocations( List<InterceptorClassMetadata<?>> interceptorMetadata, InterceptionContext ctx, InterceptionType interceptionType) { List<InterceptorMethodInvocation> interceptorInvocations = new ArrayList<InterceptorMethodInvocation>(interceptorMetadata.size()); for (InterceptorClassMetadata<?> metadata : interceptorMetadata) { Object interceptorInstance = ctx.getInterceptorInstance(metadata); InterceptorInvocation invocation = metadata.getInterceptorInvocation(interceptorInstance, interceptionType); interceptorInvocations.addAll(invocation.getInterceptorMethodInvocations()); } return interceptorInvocations; }