private static String restPath(Method method, HttpMethod httpMethod) {
if (httpMethod == HttpMethod.OPTIONS) {
return "";
}
String fromPath = getPathFromAnnotation(method);
if (fromPath == null || fromPath.isEmpty()) {
fromPath = List.of(prefixesMap.get(httpMethod))
.filter(prefix -> method.getName().toLowerCase().startsWith(prefix))
.map(prefix -> method.getName().replace(prefix, "").toLowerCase())
.getOrElse("");
//if still empty
if (fromPath.isEmpty()) {
fromPath = method.getName();
}
}
if (httpMethod == HttpMethod.GET) {
if (fromPath == null || fromPath.isEmpty()) {
fromPath = javaslang.collection.List.of(method.getParameters())
.map(p -> "{" + p.getName() + "}").getOrElse("");
}
}
return fromPath;
}
RestHelper.java 文件源码
java
阅读 25
收藏 0
点赞 0
评论 0
项目:drinkwater-java
作者:
评论列表
文章目录