use of com.dtflys.forest.lifecycles.BaseAnnotationLifeCycle in project forest by dromara.
the class InterfaceProxyHandler method processBaseAnnotation.
@SuppressWarnings("deprecation")
private void processBaseAnnotation(Class parentAnnType, Annotation[] annotations) {
for (int i = 0; i < annotations.length; i++) {
Annotation annotation = annotations[i];
Class<? extends Annotation> annType = annotation.annotationType();
if (annType.getName().startsWith("java.")) {
continue;
}
Annotation[] subAnnotations = annType.getAnnotations();
if (parentAnnType != null && !annType.equals(parentAnnType)) {
processBaseAnnotation(annType, subAnnotations);
}
if (annotation instanceof BaseURL) {
BaseURL baseURLAnn = (BaseURL) annotation;
String value = baseURLAnn.value();
if (value == null || value.trim().length() == 0) {
continue;
}
String baseURL = value.trim();
baseMetaRequest.setUrl(baseURL);
} else {
BaseLifeCycle baseLifeCycle = annotation.annotationType().getAnnotation(BaseLifeCycle.class);
MethodLifeCycle methodLifeCycle = annotation.annotationType().getAnnotation(MethodLifeCycle.class);
if (baseLifeCycle != null || methodLifeCycle != null) {
if (baseLifeCycle != null) {
Class<? extends BaseAnnotationLifeCycle> interceptorClass = baseLifeCycle.value();
if (interceptorClass != null) {
BaseAnnotationLifeCycle baseInterceptor = interceptorFactory.getInterceptor(interceptorClass);
baseInterceptor.onProxyHandlerInitialized(this, annotation);
}
}
baseAnnotations.add(annotation);
}
}
}
}
Aggregations