
com.github.ydoc.core.StrategySelector Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ydoc-spring-boot-starter Show documentation
Show all versions of ydoc-spring-boot-starter Show documentation
YDoc一款低侵入性、简洁并同时支持SwaggerUi和YApi的文档生成器
The newest version!
package com.github.ydoc.core;
import java.lang.annotation.Annotation;
import java.util.*;
import com.github.ydoc.core.handler.api.*;
import com.github.ydoc.core.kv.DocApi;
import com.github.ydoc.core.strategy.AbstractStrategy;
/**
* @author nobugboy
**/
public class StrategySelector {
private static final Map> STRATEGY_MAP;
static {
STRATEGY_MAP = new HashMap>() {
{
put("GetMapping", new GetHandler());
put("PutMapping", new PutHandler());
put("PostMapping", new PostHandler());
put("DeleteMapping", new DeleteHandler());
put("RequestMapping", new RequestHandler());
}
};
}
@SuppressWarnings("unchecked")
public static void matchAndGenerateApi(DocApi docApi) {
Annotation[] annotations = docApi.getMethod().getAnnotations();
stop: for (Annotation annotation : annotations) {
String key = Core.proxyToTargetClassName(annotation);
AbstractStrategy docApiAbstractStrategy = STRATEGY_MAP.get(key);
docApiAbstractStrategy.setProxy(annotation);
docApiAbstractStrategy.generateApi(docApi);
break stop;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy