in bytekit-core/src/main/java/com/alibaba/bytekit/asm/interceptor/parser/DefaultInterceptorClassParser.java [18:48]
public List<InterceptorProcessor> parse(Class<?> clazz) {
final List<InterceptorProcessor> result = new ArrayList<InterceptorProcessor>();
MethodCallback methodCallback = new MethodCallback() {
@Override
public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException {
for (Annotation onMethodAnnotation : method.getAnnotations()) {
for (Annotation onAnnotation : onMethodAnnotation.annotationType().getAnnotations()) {
if (InterceptorParserHander.class.isAssignableFrom(onAnnotation.annotationType())) {
if (!Modifier.isStatic(method.getModifiers())) {
throw new IllegalArgumentException("method must be static. method: " + method);
}
InterceptorParserHander handler = (InterceptorParserHander) onAnnotation;
InterceptorProcessorParser interceptorProcessorParser = InstanceUtils
.newInstance(handler.parserHander());
InterceptorProcessor interceptorProcessor = interceptorProcessorParser.parse(method,
onMethodAnnotation);
result.add(interceptorProcessor);
}
}
}
}
};
ReflectionUtils.doWithMethods(clazz, methodCallback);
return result;
}