diff --git a/src/main/java/com/power/doc/filter/BoxReturnFilter.java b/src/main/java/com/power/doc/filter/BoxReturnFilter.java index c5f5e26..d877a0e 100644 --- a/src/main/java/com/power/doc/filter/BoxReturnFilter.java +++ b/src/main/java/com/power/doc/filter/BoxReturnFilter.java @@ -26,8 +26,8 @@ public class BoxReturnFilter implements ReturnTypeFilter { @Override public ApiReturn doFilter(String fullyName) { - ApiReturn apiReturn = new ApiReturn(); if (TYPE_SET.stream().anyMatch(fullyName::startsWith)) { + ApiReturn apiReturn = new ApiReturn(); if (fullyName.contains("<")) { String[] strings = DocClassUtil.getSimpleGicName(fullyName); String newFullName = strings[0]; @@ -42,9 +42,9 @@ public class BoxReturnFilter implements ReturnTypeFilter { //directly return Java Object apiReturn.setGenericCanonicalName(DocGlobalConstants.JAVA_OBJECT_FULLY); apiReturn.setSimpleName(DocGlobalConstants.JAVA_OBJECT_FULLY); - return apiReturn; } + return apiReturn; } - return apiReturn; + return null; } } diff --git a/src/main/java/com/power/doc/filter/DefaultReturnFilter.java b/src/main/java/com/power/doc/filter/DefaultReturnFilter.java index c93a838..82fd676 100644 --- a/src/main/java/com/power/doc/filter/DefaultReturnFilter.java +++ b/src/main/java/com/power/doc/filter/DefaultReturnFilter.java @@ -3,6 +3,7 @@ package com.power.doc.filter; import com.power.doc.model.ApiReturn; /** + * must be put last * @author yu 2020/4/17. */ public class DefaultReturnFilter implements ReturnTypeFilter { diff --git a/src/main/java/com/power/doc/filter/ReturnTypeProcessor.java b/src/main/java/com/power/doc/filter/ReturnTypeProcessor.java index 858e525..99b886d 100644 --- a/src/main/java/com/power/doc/filter/ReturnTypeProcessor.java +++ b/src/main/java/com/power/doc/filter/ReturnTypeProcessor.java @@ -4,6 +4,7 @@ import com.power.doc.model.ApiReturn; import java.util.ArrayList; import java.util.List; +import java.util.Objects; /** * @author yu 2020/4/17. @@ -29,6 +30,9 @@ public class ReturnTypeProcessor { ApiReturn apiReturn = null; for (ReturnTypeFilter filter : filters) { apiReturn = filter.doFilter(typeName); + if (Objects.nonNull(apiReturn)) { + return apiReturn; + } } return apiReturn; } diff --git a/src/main/java/com/power/doc/filter/WebFluxReturnFilter.java b/src/main/java/com/power/doc/filter/WebFluxReturnFilter.java index 94d4336..bdbe816 100644 --- a/src/main/java/com/power/doc/filter/WebFluxReturnFilter.java +++ b/src/main/java/com/power/doc/filter/WebFluxReturnFilter.java @@ -10,16 +10,16 @@ public class WebFluxReturnFilter implements ReturnTypeFilter { @Override public ApiReturn doFilter(String fullyName) { - ApiReturn apiReturn = new ApiReturn(); //support web flux if (fullyName.startsWith("reactor.core.publisher.Flux")) { + ApiReturn apiReturn = new ApiReturn(); // rewrite type name fullyName = fullyName.replace("reactor.core.publisher.Flux", DocGlobalConstants.JAVA_LIST_FULLY); apiReturn.setGenericCanonicalName(fullyName); apiReturn.setSimpleName(DocGlobalConstants.JAVA_LIST_FULLY); return apiReturn; } - return apiReturn; + return null; } } diff --git a/src/main/java/com/power/doc/utils/DocUtil.java b/src/main/java/com/power/doc/utils/DocUtil.java index e147aeb..49e57a8 100644 --- a/src/main/java/com/power/doc/utils/DocUtil.java +++ b/src/main/java/com/power/doc/utils/DocUtil.java @@ -356,7 +356,8 @@ public class DocUtil { */ public static Map getFieldTagsValue(final JavaField field) { List paramTags = field.getTags(); - return paramTags.stream().collect(Collectors.toMap(DocletTag::getName, DocletTag::getValue)); + return paramTags.stream().collect(Collectors.toMap(DocletTag::getName, DocletTag::getValue, + (key1, key2) -> key1 + "," + key2)); } /**