use of act.util.AnnotatedClassFinder in project actframework by actframework.
the class RequestHandlerProxy method registerGlobalInterceptors.
@AnnotatedClassFinder(value = Global.class, callOn = SysEventId.PRE_START)
@SuppressWarnings("unused")
public static void registerGlobalInterceptors(Class<?> interceptorClass) {
App app = Act.app();
if (BeforeInterceptor.class.isAssignableFrom(interceptorClass)) {
BeforeInterceptor interceptor = (BeforeInterceptor) app.getInstance(interceptorClass);
registerGlobalInterceptor(interceptor);
} else if (AfterInterceptor.class.isAssignableFrom(interceptorClass)) {
AfterInterceptor interceptor = (AfterInterceptor) app.getInstance(interceptorClass);
registerGlobalInterceptor(interceptor);
} else if (ExceptionInterceptor.class.isAssignableFrom(interceptorClass)) {
ExceptionInterceptor interceptor = (ExceptionInterceptor) app.getInstance(interceptorClass);
registerGlobalInterceptor(interceptor);
} else if (FinallyInterceptor.class.isAssignableFrom(interceptorClass)) {
FinallyInterceptor interceptor = (FinallyInterceptor) app.getInstance(interceptorClass);
registerGlobalInterceptor(interceptor);
} else {
// check if this is a free style interceptor
ControllerClassMetaInfo metaInfo = app.classLoader().controllerClassMetaInfo(interceptorClass.getName());
if (null != metaInfo) {
registerGlobalInterceptor(metaInfo.interceptors());
}
}
}
Aggregations