fix gitee #I1ENNM

This commit is contained in:
oppofind 2020-04-17 23:00:20 +08:00
parent 883e2f7ff5
commit b67a7da767
5 changed files with 12 additions and 6 deletions

View File

@ -26,8 +26,8 @@ public class BoxReturnFilter implements ReturnTypeFilter {
@Override @Override
public ApiReturn doFilter(String fullyName) { public ApiReturn doFilter(String fullyName) {
ApiReturn apiReturn = new ApiReturn();
if (TYPE_SET.stream().anyMatch(fullyName::startsWith)) { if (TYPE_SET.stream().anyMatch(fullyName::startsWith)) {
ApiReturn apiReturn = new ApiReturn();
if (fullyName.contains("<")) { if (fullyName.contains("<")) {
String[] strings = DocClassUtil.getSimpleGicName(fullyName); String[] strings = DocClassUtil.getSimpleGicName(fullyName);
String newFullName = strings[0]; String newFullName = strings[0];
@ -42,9 +42,9 @@ public class BoxReturnFilter implements ReturnTypeFilter {
//directly return Java Object //directly return Java Object
apiReturn.setGenericCanonicalName(DocGlobalConstants.JAVA_OBJECT_FULLY); apiReturn.setGenericCanonicalName(DocGlobalConstants.JAVA_OBJECT_FULLY);
apiReturn.setSimpleName(DocGlobalConstants.JAVA_OBJECT_FULLY); apiReturn.setSimpleName(DocGlobalConstants.JAVA_OBJECT_FULLY);
return apiReturn;
}
} }
return apiReturn; return apiReturn;
} }
return null;
}
} }

View File

@ -3,6 +3,7 @@ package com.power.doc.filter;
import com.power.doc.model.ApiReturn; import com.power.doc.model.ApiReturn;
/** /**
* must be put last
* @author yu 2020/4/17. * @author yu 2020/4/17.
*/ */
public class DefaultReturnFilter implements ReturnTypeFilter { public class DefaultReturnFilter implements ReturnTypeFilter {

View File

@ -4,6 +4,7 @@ import com.power.doc.model.ApiReturn;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects;
/** /**
* @author yu 2020/4/17. * @author yu 2020/4/17.
@ -29,6 +30,9 @@ public class ReturnTypeProcessor {
ApiReturn apiReturn = null; ApiReturn apiReturn = null;
for (ReturnTypeFilter filter : filters) { for (ReturnTypeFilter filter : filters) {
apiReturn = filter.doFilter(typeName); apiReturn = filter.doFilter(typeName);
if (Objects.nonNull(apiReturn)) {
return apiReturn;
}
} }
return apiReturn; return apiReturn;
} }

View File

@ -10,16 +10,16 @@ public class WebFluxReturnFilter implements ReturnTypeFilter {
@Override @Override
public ApiReturn doFilter(String fullyName) { public ApiReturn doFilter(String fullyName) {
ApiReturn apiReturn = new ApiReturn();
//support web flux //support web flux
if (fullyName.startsWith("reactor.core.publisher.Flux")) { if (fullyName.startsWith("reactor.core.publisher.Flux")) {
ApiReturn apiReturn = new ApiReturn();
// rewrite type name // rewrite type name
fullyName = fullyName.replace("reactor.core.publisher.Flux", DocGlobalConstants.JAVA_LIST_FULLY); fullyName = fullyName.replace("reactor.core.publisher.Flux", DocGlobalConstants.JAVA_LIST_FULLY);
apiReturn.setGenericCanonicalName(fullyName); apiReturn.setGenericCanonicalName(fullyName);
apiReturn.setSimpleName(DocGlobalConstants.JAVA_LIST_FULLY); apiReturn.setSimpleName(DocGlobalConstants.JAVA_LIST_FULLY);
return apiReturn; return apiReturn;
} }
return apiReturn; return null;
} }
} }

View File

@ -356,7 +356,8 @@ public class DocUtil {
*/ */
public static Map<String, String> getFieldTagsValue(final JavaField field) { public static Map<String, String> getFieldTagsValue(final JavaField field) {
List<DocletTag> paramTags = field.getTags(); List<DocletTag> 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));
} }
/** /**