@@ -136,6 +136,10 @@ public class DocUtil {
136136 */
137137 public static String jsonValueByType (String typeName ) {
138138 String type = typeName .contains ("." ) ? typeName .substring (typeName .lastIndexOf ("." ) + 1 ) : typeName ;
139+ // if the type is Instant, transform to LocalDateTime
140+ if ("Instant" .equalsIgnoreCase (type )) {
141+ type = "LocalDateTime" ;
142+ }
139143 String randomMock = System .getProperty (DocGlobalConstants .RANDOM_MOCK );
140144 boolean randomMockFlag = Boolean .parseBoolean (randomMock );
141145 String value = "" ;
@@ -569,9 +573,11 @@ public static Map<String, String> getRecordCommentsByTag(JavaClass javaClass, fi
569573 "Please @see " + className ;
570574 return getCommentsByTag (paramTags , tagName , className , tagValNullMsg , tagValErrorMsg );
571575 }
572- public static Map <String , String > getCommentsByTag (List <DocletTag > paramTags , final String tagName ){
573- return getCommentsByTag (paramTags , tagName , null , null ,null );
576+
577+ public static Map <String , String > getCommentsByTag (List <DocletTag > paramTags , final String tagName ) {
578+ return getCommentsByTag (paramTags , tagName , null , null , null );
574579 }
580+
575581 private static Map <String , String > getCommentsByTag (List <DocletTag > paramTags , final String tagName , String className ,
576582 String tagValNullMsg , String tagValErrorMsg ) {
577583 Map <String , String > paramTagMap = new HashMap <>(16 );
@@ -745,6 +751,7 @@ public static String javaTypeToOpenApiTypeConvert(String javaTypeName) {
745751 case "enum" :
746752 case "java.util.date" :
747753 case "localdatetime" :
754+ case "java.time.instant" :
748755 case "java.time.localdatetime" :
749756 case "java.time.year" :
750757 case "java.time.localtime" :
@@ -775,6 +782,7 @@ public static String javaTypeToOpenApiTypeConvert(String javaTypeName) {
775782 case "arraylist" :
776783 case "java.util.treeset" :
777784 case "treeset" :
785+ case "enumset" :
778786 return "array" ;
779787 case "java.util.byte" :
780788 case "byte" :
@@ -1064,9 +1072,9 @@ public static List<ApiDocDict> buildDictionary(ApiConfig config, JavaProjectBuil
10641072 * @return string
10651073 */
10661074 public static String formatFieldTypeGicName (Map <String , String > genericMap , String fieldGicName ) {
1067- String fieldGicNameCopy = fieldGicName ;
1068- for (Map .Entry <String ,String > entry : genericMap .entrySet ()) {
1069- fieldGicNameCopy = replaceGenericParameter (fieldGicName ,entry .getKey (), entry .getValue ());
1075+ String fieldGicNameCopy = fieldGicName ;
1076+ for (Map .Entry <String , String > entry : genericMap .entrySet ()) {
1077+ fieldGicNameCopy = replaceGenericParameter (fieldGicName , entry .getKey (), entry .getValue ());
10701078 }
10711079 return fieldGicNameCopy ;
10721080 }
@@ -1075,9 +1083,9 @@ public static String formatFieldTypeGicName(Map<String, String> genericMap, Stri
10751083 * Replaces the specified generic parameter in a string with a given type,
10761084 * supporting multi-level generics.
10771085 *
1078- * @param baseString The base string
1086+ * @param baseString The base string
10791087 * @param originalGenericParameter The generic parameter to be replaced, like "T"
1080- * @param replacementType The type to replace the original parameter with, like "User"
1088+ * @param replacementType The type to replace the original parameter with, like "User"
10811089 * @return The modified string
10821090 */
10831091 public static String replaceGenericParameter (String baseString , String originalGenericParameter , String replacementType ) {
@@ -1258,16 +1266,17 @@ public static List<String> splitPathBySlash(String url) {
12581266
12591267 /**
12601268 * parse tag value, detect the value type, should be one type of String, Map, List
1269+ *
12611270 * @param value tag value
12621271 * @return one of String, Map, List
12631272 */
1264- public static Object detectTagValue (String value ){
1273+ public static Object detectTagValue (String value ) {
12651274 String v = value .trim ();
12661275 //if the value is a List
1267- if (v .startsWith ("[" ) && v .endsWith ("]" )){
1276+ if (v .startsWith ("[" ) && v .endsWith ("]" )) {
12681277 return JsonUtil .toObject (v , List .class );
12691278 }
1270- if (v .startsWith ("{" ) && v .endsWith ("}" )){
1279+ if (v .startsWith ("{" ) && v .endsWith ("}" )) {
12711280 return JsonUtil .toObject (v , Map .class );
12721281 }
12731282 return v ;
0 commit comments