From 46cafbb53439d923faded6b717a8fe963fac83ac Mon Sep 17 00:00:00 2001 From: duanledexianxianxian Date: Thu, 26 Mar 2020 22:48:10 +0800 Subject: [PATCH] :recycle: Refactoring code. --- .../java/com/apidoc/core/schema/Header.java | 39 ---- .../java/com/apidoc/core/schema/Method.java | 19 -- .../main/java/com/apidoc/core/schema/Row.java | 22 -- .../java/com/apidoc/core/schema/Section.java | 107 ---------- .../main/java/com/apidoc/core/schema/Tag.java | 33 --- .../java/{com => kim}/apidoc/core/ApiDoc.java | 60 +++--- .../{com => kim}/apidoc/core/Context.java | 10 +- .../apidoc/core/common/Assert.java | 2 +- .../apidoc/core/common/ObjectMappers.java | 2 +- .../core/common/QueryStringBuilder.java | 2 +- .../{com => kim}/apidoc/core/common/URI.java | 4 +- .../description/ArrayTypeDescription.java | 44 ++-- .../description/ObjectTypeDescription.java | 10 +- .../description/PrimitiveTypeDescription.java | 15 +- .../description/StringTypeDescription.java | 7 +- .../common/description/TypeDescription.java | 28 +-- .../UnAvailableTypeDescription.java | 4 +- .../apidoc/core/common/diff/FileMatcher.java | 4 +- .../apidoc/core/common/diff/FileSystem.java | 26 +-- .../apidoc/core/common/diff/MatchPatcher.java | 2 +- .../core/common/helper/AnnotationHelper.java | 2 +- .../common/helper/ClassDeclarationHelper.java | 2 +- .../core/common/helper/CommentHelper.java | 2 +- .../common/helper/CompilationUnitHelper.java | 2 +- .../core/common/helper/ExpressionHelper.java | 2 +- .../core/common/helper/FieldHelper.java | 2 +- .../apidoc/core/common/helper/FileHelper.java | 2 +- .../common/helper/JsonPropertyHelper.java | 2 +- .../core/common/helper/OptionalHelper.java | 2 +- .../core/common/helper/ReferenceContext.java | 2 +- .../core/common/helper/StringHelper.java | 2 +- .../core/common/helper/TypeNameHelper.java | 2 +- .../common/helper/TypeParameterHelper.java | 2 +- .../core/common/helper/ValidationHelper.java | 2 +- .../core/common/markup/MarkupBuilder.java | 4 +- .../core/common/markup/asciidoc/AsciiDoc.java | 2 +- .../markup/asciidoc/AsciiDocBuilder.java | 6 +- .../core/common/markup/asciidoc/Color.java | 2 +- .../core/common/markup/markdown/Markdown.java | 2 +- .../markup/markdown/MarkdownBuilder.java | 76 ++++--- .../apidoc/core/common/postman/Body.java | 2 +- .../apidoc/core/common/postman/BodyMode.java | 2 +- .../apidoc/core/common/postman/Folder.java | 2 +- .../apidoc/core/common/postman/Info.java | 2 +- .../apidoc/core/common/postman/Item.java | 2 +- .../apidoc/core/common/postman/Parameter.java | 4 +- .../apidoc/core/common/postman/Postman.java | 2 +- .../apidoc/core/common/postman/Request.java | 6 +- .../apidoc/core/common/postman/Response.java | 4 +- .../apidoc/core/common/postman/Url.java | 2 +- .../apidoc/core/parser/ParserStrategy.java | 6 +- .../apidoc/core/parser/VisitorParser.java | 12 +- .../apidoc/core/render/AsciiDocRender.java | 16 +- .../apidoc/core/render/MarkdownRender.java | 18 ++ .../apidoc/core/render/PostmanRender.java | 12 +- .../apidoc/core/render/ProjectRender.java | 4 +- .../core/resolver/ArrayTypeResolver.java | 8 +- .../core/resolver/CollectionTypeResolver.java | 12 +- .../core/resolver/DateTypeResolver.java | 6 +- .../core/resolver/EnumTypeResolver.java | 6 +- .../apidoc/core/resolver/MapTypeResolver.java | 32 +-- .../core/resolver/ObjectTypeResolver.java | 10 +- .../core/resolver/PrimitiveTypeResolver.java | 6 +- .../core/resolver/StringTypeResolver.java | 6 +- .../resolver/SystemObjectTypeResolver.java | 6 +- .../core/resolver/TypeNameResolver.java | 4 +- .../apidoc/core/resolver/TypeResolver.java | 4 +- .../apidoc/core/resolver/TypeResolvers.java | 8 +- .../{com => kim}/apidoc/core/schema/Book.java | 19 +- .../apidoc/core/schema/Chapter.java | 11 +- .../java/kim/apidoc/core/schema/Header.java | 72 +++++++ .../java/kim/apidoc/core/schema/Method.java | 84 ++++++++ .../{com => kim}/apidoc/core/schema/Node.java | 8 +- .../apidoc/core/schema/Project.java | 4 +- .../main/java/kim/apidoc/core/schema/Row.java | 48 +++++ .../java/kim/apidoc/core/schema/Section.java | 198 ++++++++++++++++++ .../main/java/kim/apidoc/core/schema/Tag.java | 51 +++++ .../apidoc}/springmvc/ParameterHelper.java | 2 +- .../springmvc/RequestMappingHelper.java | 12 +- .../apidoc}/springmvc/SpringMVCContext.java | 4 +- .../apidoc}/springmvc/SpringParser.java | 37 ++-- .../resovler/SpringComponentTypeResolver.java | 16 +- .../com.apidoc.core.parser.ParserStrategy | 1 - .../kim.apidoc.core.parser.ParserStrategy | 1 + .../apidoc}/example/ApigccTest.java | 6 +- .../example/annotation/KimController.java | 2 +- .../example/annotation/KimResponseBody.java | 2 +- .../apidoc}/example/common/Code.java | 2 +- .../apidoc}/example/common/Menu.java | 2 +- .../apidoc}/example/common/Page.java | 2 +- .../apidoc}/example/common/Query.java | 2 +- .../apidoc}/example/common/ResultData.java | 2 +- .../apidoc}/example/common/Role.java | 2 +- .../example/common/StaticFinalCode.java | 2 +- .../apidoc}/example/common/User.java | 2 +- .../apidoc}/example/common/UserDTO.java | 2 +- .../apidoc}/example/common/UserDetails.java | 2 +- .../apidoc}/example/common/UserQuery.java | 2 +- .../apidoc}/example/common/Wrapper.java | 2 +- .../example/spring/BaseController.java | 2 +- .../spring/advanced/AuthController.java | 6 +- .../spring/advanced/EmptyController.java | 2 +- .../spring/advanced/IgnoreController.java | 2 +- .../spring/advanced/KimUserController.java | 8 +- .../spring/advanced/PageController.java | 8 +- .../spring/advanced/UserController.java | 6 +- .../example/spring/hello/Greeting.java | 2 +- .../spring/hello/GreetingController.java | 2 +- .../apidoc}/springmvc/SpringTest.java | 14 +- ...45\345\217\243\346\250\241\347\211\210.md" | 10 +- 110 files changed, 849 insertions(+), 579 deletions(-) delete mode 100644 apidoc-core/src/main/java/com/apidoc/core/schema/Header.java delete mode 100644 apidoc-core/src/main/java/com/apidoc/core/schema/Method.java delete mode 100644 apidoc-core/src/main/java/com/apidoc/core/schema/Row.java delete mode 100644 apidoc-core/src/main/java/com/apidoc/core/schema/Section.java delete mode 100644 apidoc-core/src/main/java/com/apidoc/core/schema/Tag.java rename apidoc-core/src/main/java/{com => kim}/apidoc/core/ApiDoc.java (83%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/Context.java (92%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/common/Assert.java (95%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/common/ObjectMappers.java (97%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/common/QueryStringBuilder.java (96%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/common/URI.java (94%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/common/description/ArrayTypeDescription.java (64%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/common/description/ObjectTypeDescription.java (95%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/common/description/PrimitiveTypeDescription.java (89%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/common/description/StringTypeDescription.java (64%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/common/description/TypeDescription.java (79%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/common/description/UnAvailableTypeDescription.java (85%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/common/diff/FileMatcher.java (96%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/common/diff/FileSystem.java (90%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/common/diff/MatchPatcher.java (99%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/common/helper/AnnotationHelper.java (97%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/common/helper/ClassDeclarationHelper.java (97%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/common/helper/CommentHelper.java (98%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/common/helper/CompilationUnitHelper.java (92%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/common/helper/ExpressionHelper.java (98%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/common/helper/FieldHelper.java (97%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/common/helper/FileHelper.java (97%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/common/helper/JsonPropertyHelper.java (97%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/common/helper/OptionalHelper.java (89%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/common/helper/ReferenceContext.java (95%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/common/helper/StringHelper.java (96%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/common/helper/TypeNameHelper.java (97%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/common/helper/TypeParameterHelper.java (98%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/common/helper/ValidationHelper.java (97%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/common/markup/MarkupBuilder.java (97%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/common/markup/asciidoc/AsciiDoc.java (97%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/common/markup/asciidoc/AsciiDocBuilder.java (98%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/common/markup/asciidoc/Color.java (95%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/common/markup/markdown/Markdown.java (96%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/common/markup/markdown/MarkdownBuilder.java (75%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/common/postman/Body.java (87%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/common/postman/BodyMode.java (71%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/common/postman/Folder.java (88%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/common/postman/Info.java (86%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/common/postman/Item.java (89%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/common/postman/Parameter.java (86%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/common/postman/Postman.java (89%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/common/postman/Request.java (70%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/common/postman/Response.java (81%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/common/postman/Url.java (87%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/parser/ParserStrategy.java (90%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/parser/VisitorParser.java (87%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/render/AsciiDocRender.java (94%) create mode 100644 apidoc-core/src/main/java/kim/apidoc/core/render/MarkdownRender.java rename apidoc-core/src/main/java/{com => kim}/apidoc/core/render/PostmanRender.java (94%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/render/ProjectRender.java (74%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/resolver/ArrayTypeResolver.java (69%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/resolver/CollectionTypeResolver.java (80%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/resolver/DateTypeResolver.java (84%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/resolver/EnumTypeResolver.java (85%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/resolver/MapTypeResolver.java (73%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/resolver/ObjectTypeResolver.java (93%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/resolver/PrimitiveTypeResolver.java (87%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/resolver/StringTypeResolver.java (82%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/resolver/SystemObjectTypeResolver.java (81%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/resolver/TypeNameResolver.java (62%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/resolver/TypeResolver.java (66%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/resolver/TypeResolvers.java (92%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/schema/Book.java (54%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/schema/Chapter.java (62%) create mode 100644 apidoc-core/src/main/java/kim/apidoc/core/schema/Header.java create mode 100644 apidoc-core/src/main/java/kim/apidoc/core/schema/Method.java rename apidoc-core/src/main/java/{com => kim}/apidoc/core/schema/Node.java (95%) rename apidoc-core/src/main/java/{com => kim}/apidoc/core/schema/Project.java (89%) create mode 100644 apidoc-core/src/main/java/kim/apidoc/core/schema/Row.java create mode 100644 apidoc-core/src/main/java/kim/apidoc/core/schema/Section.java create mode 100644 apidoc-core/src/main/java/kim/apidoc/core/schema/Tag.java rename apidoc-springmvc/src/main/java/com/{apigcc => kim/apidoc}/springmvc/ParameterHelper.java (98%) rename apidoc-springmvc/src/main/java/com/{apigcc => kim/apidoc}/springmvc/RequestMappingHelper.java (96%) rename apidoc-springmvc/src/main/java/com/{apigcc => kim/apidoc}/springmvc/SpringMVCContext.java (96%) rename apidoc-springmvc/src/main/java/com/{apigcc => kim/apidoc}/springmvc/SpringParser.java (92%) rename apidoc-springmvc/src/main/java/com/{apigcc => kim/apidoc}/springmvc/resovler/SpringComponentTypeResolver.java (82%) delete mode 100644 apidoc-springmvc/src/main/resources/META-INF/services/com.apidoc.core.parser.ParserStrategy create mode 100644 apidoc-springmvc/src/main/resources/META-INF/services/kim.apidoc.core.parser.ParserStrategy rename apidoc-springmvc/src/test/java/com/{apigcc => kim/apidoc}/example/ApigccTest.java (85%) rename apidoc-springmvc/src/test/java/com/{apigcc => kim/apidoc}/example/annotation/KimController.java (94%) rename apidoc-springmvc/src/test/java/com/{apigcc => kim/apidoc}/example/annotation/KimResponseBody.java (90%) rename apidoc-springmvc/src/test/java/com/{apigcc => kim/apidoc}/example/common/Code.java (80%) rename apidoc-springmvc/src/test/java/com/{apigcc => kim/apidoc}/example/common/Menu.java (74%) rename apidoc-springmvc/src/test/java/com/{apigcc => kim/apidoc}/example/common/Page.java (88%) rename apidoc-springmvc/src/test/java/com/{apigcc => kim/apidoc}/example/common/Query.java (80%) rename apidoc-springmvc/src/test/java/com/{apigcc => kim/apidoc}/example/common/ResultData.java (87%) rename apidoc-springmvc/src/test/java/com/{apigcc => kim/apidoc}/example/common/Role.java (76%) rename apidoc-springmvc/src/test/java/com/{apigcc => kim/apidoc}/example/common/StaticFinalCode.java (77%) rename apidoc-springmvc/src/test/java/com/{apigcc => kim/apidoc}/example/common/User.java (87%) rename apidoc-springmvc/src/test/java/com/{apigcc => kim/apidoc}/example/common/UserDTO.java (89%) rename apidoc-springmvc/src/test/java/com/{apigcc => kim/apidoc}/example/common/UserDetails.java (78%) rename apidoc-springmvc/src/test/java/com/{apigcc => kim/apidoc}/example/common/UserQuery.java (75%) rename apidoc-springmvc/src/test/java/com/{apigcc => kim/apidoc}/example/common/Wrapper.java (70%) rename apidoc-springmvc/src/test/java/com/{apigcc => kim/apidoc}/example/spring/BaseController.java (79%) rename apidoc-springmvc/src/test/java/com/{apigcc => kim/apidoc}/example/spring/advanced/AuthController.java (70%) rename apidoc-springmvc/src/test/java/com/{apigcc => kim/apidoc}/example/spring/advanced/EmptyController.java (78%) rename apidoc-springmvc/src/test/java/com/{apigcc => kim/apidoc}/example/spring/advanced/IgnoreController.java (81%) rename apidoc-springmvc/src/test/java/com/{apigcc => kim/apidoc}/example/spring/advanced/KimUserController.java (82%) rename apidoc-springmvc/src/test/java/com/{apigcc => kim/apidoc}/example/spring/advanced/PageController.java (89%) rename apidoc-springmvc/src/test/java/com/{apigcc => kim/apidoc}/example/spring/advanced/UserController.java (92%) rename apidoc-springmvc/src/test/java/com/{apigcc => kim/apidoc}/example/spring/hello/Greeting.java (84%) rename apidoc-springmvc/src/test/java/com/{apigcc => kim/apidoc}/example/spring/hello/GreetingController.java (94%) rename apidoc-springmvc/src/test/java/com/{apigcc => kim/apidoc}/springmvc/SpringTest.java (86%) diff --git a/apidoc-core/src/main/java/com/apidoc/core/schema/Header.java b/apidoc-core/src/main/java/com/apidoc/core/schema/Header.java deleted file mode 100644 index f3f6df4..0000000 --- a/apidoc-core/src/main/java/com/apidoc/core/schema/Header.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.apidoc.core.schema; - -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Setter -@Getter -@NoArgsConstructor -public class Header{ - - public static final Header APPLICATION_JSON = new Header("Content-Type","application/json"); - public static final Header X_FORM_WWW_URLENCODED = new Header("Content-Type","x-www-form-urlencoded"); - - String key; - String value; - String description; - - public Header(String key, String value) { - this.key = key; - this.value = value; - } - - public static Header valueOf(String text){ - String[] arr = text.split(":"); - Header header = new Header(); - header.setKey(arr[0]); - if(arr.length>1){ - header.setValue(arr[1]); - } - return header; - } - - @Override - public String toString(){ - return key + ": " + value; - } - -} diff --git a/apidoc-core/src/main/java/com/apidoc/core/schema/Method.java b/apidoc-core/src/main/java/com/apidoc/core/schema/Method.java deleted file mode 100644 index a4f3226..0000000 --- a/apidoc-core/src/main/java/com/apidoc/core/schema/Method.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.apidoc.core.schema; - -import lombok.extern.slf4j.Slf4j; - -/** - * 支持的http method - */ -@Slf4j -public enum Method { - - - GET,POST,PUT,DELETE, - OPTIONS,PATCH,COPY,HEAD,LINK,UNLINK,PURGE,LOCK,UNLOCK,PROPFIND,VIEW; - - public static Method of(String name) { - return valueOf(name); - } - -} diff --git a/apidoc-core/src/main/java/com/apidoc/core/schema/Row.java b/apidoc-core/src/main/java/com/apidoc/core/schema/Row.java deleted file mode 100644 index d4fc404..0000000 --- a/apidoc-core/src/main/java/com/apidoc/core/schema/Row.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.apidoc.core.schema; - -import lombok.*; - -@EqualsAndHashCode -@NoArgsConstructor -@AllArgsConstructor -@Setter -@Getter -public class Row { - - String key; - String type; - String condition; - String def; - String remark; - - public Row(String type) { - this.type = type; - } - -} diff --git a/apidoc-core/src/main/java/com/apidoc/core/schema/Section.java b/apidoc-core/src/main/java/com/apidoc/core/schema/Section.java deleted file mode 100644 index d6be636..0000000 --- a/apidoc-core/src/main/java/com/apidoc/core/schema/Section.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.apidoc.core.schema; - -import com.apidoc.core.common.ObjectMappers; -import com.apidoc.core.common.QueryStringBuilder; -import com.apidoc.core.common.helper.StringHelper; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ObjectNode; -import lombok.Getter; -import lombok.Setter; - -import java.util.*; - -/** - * 小节,一个请求,封装为一个小节 - */ -@Setter -@Getter -public class Section extends Node { - - Method method; - String uri; - Map inHeaders = new LinkedHashMap<>(); - ObjectNode pathVariable = ObjectMappers.instance.createObjectNode(); - JsonNode parameter; - boolean queryParameter = true; - Map requestRows = new LinkedHashMap<>(); - - Map outHeaders = new LinkedHashMap<>(); - JsonNode response; - Map responseRows = new LinkedHashMap<>(); - Object rawResponse; - - public void addRequestRow(Row row){ - requestRows.put(row.getKey(), row); - } - - public void addRequestRows(Collection rows){ - for (Row row : rows) { - if(row.getKey()!=null && !requestRows.containsKey(row.getKey())){ - requestRows.put(row.getKey(),row); - } - } - } - - public String getRequestLine(){ - StringBuilder builder = new StringBuilder(this.method.toString()); - builder.append(" ").append(this.uri); - if(this.queryParameter && Objects.equals("GET", this.method)){ - String parameterString = getParameterString(); - if(StringHelper.nonBlank(parameterString)){ - builder.append("?").append(parameterString); - } - } - builder.append(" HTTP/1.1"); - return builder.toString(); - } - - public String getParameterString(){ - if(queryParameter && parameter instanceof ObjectNode){ - return new QueryStringBuilder().append((ObjectNode)parameter).toString(); - } - return ObjectMappers.pretty(parameter); - } - - public boolean hasRequestBody(){ - if(Objects.equals("GET",this.method)){ - return false; - } - return parameter!=null && parameter.size()>0; - } - - public void addResponseRow(Row row){ - responseRows.put(row.getKey(), row); - } - - public void addResponseRows(Collection rows){ - for (Row row : rows) { - if(row.getKey()!=null && !responseRows.containsKey(row.getKey())) { - responseRows.put(row.getKey(), row); - } - } - } - - public boolean hasResponseBody(){ - return response!=null || rawResponse!=null; - } - - public String getResponseString(){ - if(response!=null){ - return ObjectMappers.pretty(response); - } - return String.valueOf(rawResponse); - } - - public void addInHeader(Header header){ - if (!inHeaders.containsKey(header.getKey())) { - inHeaders.put(header.getKey(),header); - } - } - - public void addOutHeader(Header header){ - if (!outHeaders.containsKey(header.getKey())) { - outHeaders.put(header.getKey(),header); - } - } - -} diff --git a/apidoc-core/src/main/java/com/apidoc/core/schema/Tag.java b/apidoc-core/src/main/java/com/apidoc/core/schema/Tag.java deleted file mode 100644 index 81964c9..0000000 --- a/apidoc-core/src/main/java/com/apidoc/core/schema/Tag.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.apidoc.core.schema; - -import lombok.Getter; -import lombok.Setter; -import lombok.extern.slf4j.Slf4j; - -import java.util.Objects; - -/** - * //@param username 用户名 - * id key content - */ -@Slf4j -@Setter -@Getter -public class Tag { - - String id; - String key; - String content; - - public int getIntContent(int def){ - if (Objects.nonNull(content)) { - try{ - return Integer.parseInt(content); - }catch (Exception e){ - log.warn(content+" parse error"); - } - } - return def; - } - -} diff --git a/apidoc-core/src/main/java/com/apidoc/core/ApiDoc.java b/apidoc-core/src/main/java/kim/apidoc/core/ApiDoc.java similarity index 83% rename from apidoc-core/src/main/java/com/apidoc/core/ApiDoc.java rename to apidoc-core/src/main/java/kim/apidoc/core/ApiDoc.java index 7912a31..fc12199 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/ApiDoc.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/ApiDoc.java @@ -1,11 +1,11 @@ -package com.apidoc.core; - -import com.apidoc.core.common.helper.StringHelper; -import com.apidoc.core.parser.ParserStrategy; -import com.apidoc.core.parser.VisitorParser; -import com.apidoc.core.render.ProjectRender; -import com.apidoc.core.resolver.TypeResolvers; -import com.apidoc.core.schema.Project; +package kim.apidoc.core; + +import kim.apidoc.core.common.helper.StringHelper; +import kim.apidoc.core.parser.ParserStrategy; +import kim.apidoc.core.parser.VisitorParser; +import kim.apidoc.core.render.ProjectRender; +import kim.apidoc.core.resolver.TypeResolvers; +import kim.apidoc.core.schema.Project; import com.github.javaparser.ParseResult; import com.github.javaparser.ParserConfiguration; import com.github.javaparser.ast.CompilationUnit; @@ -38,17 +38,6 @@ public class ApiDoc { * ApiDoc实例 */ private static ApiDoc INSTANCE; - - - /** - * Get instance api doc. - * - * @return the api doc - */ - public static ApiDoc getInstance(){ - return INSTANCE; - } - /** * 上下文 */ @@ -59,7 +48,6 @@ public class ApiDoc { */ @Getter private Project project = new Project(); - /** * The Visitor parser. */ @@ -68,7 +56,6 @@ public class ApiDoc { * The Parser configuration. */ private ParserConfiguration parserConfiguration; - /** * The Type resolvers. */ @@ -78,7 +65,7 @@ public class ApiDoc { /** * Instantiates a new ApiDoc. */ - private ApiDoc(){ + private ApiDoc() { init(new Context()); } @@ -87,16 +74,25 @@ public class ApiDoc { * * @param context the context */ - public ApiDoc(Context context){ + public ApiDoc(Context context) { init(context); } + /** + * Get instance api doc. + * + * @return the api doc + */ + public static ApiDoc getInstance() { + return INSTANCE; + } + /** * 初始化环境配置 * * @param context the context */ - private void init(Context context){ + private void init(Context context) { INSTANCE = this; this.context = context; project.setId(context.getId()); @@ -133,21 +129,21 @@ public class ApiDoc { * * @return the parser strategy */ - private ParserStrategy loadParserStrategy(){ + private ParserStrategy loadParserStrategy() { ServiceLoader serviceLoader = ServiceLoader.load(ParserStrategy.class); List strategies = Lists.newArrayList(serviceLoader); - if(strategies.isEmpty()){ + if (strategies.isEmpty()) { throw new IllegalArgumentException("no ParserStrategy implements found"); } - if(StringHelper.isBlank(context.framework)){ + if (StringHelper.isBlank(context.framework)) { return strategies.get(0); } for (ParserStrategy strategy : strategies) { - if(Objects.equals(context.framework,strategy.name())){ + if (Objects.equals(context.framework, strategy.name())) { return strategy; } } - throw new IllegalArgumentException("no ParserStrategy implements found for "+context.framework); + throw new IllegalArgumentException("no ParserStrategy implements found for " + context.framework); } /** @@ -155,12 +151,12 @@ public class ApiDoc { * * @return project project */ - public Project parse(){ + public Project parse() { for (Path source : this.context.getSources()) { SourceRoot root = new SourceRoot(source, parserConfiguration); try { for (ParseResult result : root.tryToParse()) { - if(result.isSuccessful() && result.getResult().isPresent()){ + if (result.isSuccessful() && result.getResult().isPresent()) { result.getResult().get().accept(visitorParser, project); } } @@ -174,7 +170,7 @@ public class ApiDoc { /** * 渲染解析结果 */ - public void render(){ + public void render() { for (ProjectRender render : this.context.getRenders()) { render.render(project); } diff --git a/apidoc-core/src/main/java/com/apidoc/core/Context.java b/apidoc-core/src/main/java/kim/apidoc/core/Context.java similarity index 92% rename from apidoc-core/src/main/java/com/apidoc/core/Context.java rename to apidoc-core/src/main/java/kim/apidoc/core/Context.java index eef875d..01d1ed0 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/Context.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/Context.java @@ -1,9 +1,9 @@ -package com.apidoc.core; +package kim.apidoc.core; -import com.apidoc.core.common.helper.FileHelper; -import com.apidoc.core.render.AsciiDocRender; -import com.apidoc.core.render.PostmanRender; -import com.apidoc.core.render.ProjectRender; +import kim.apidoc.core.common.helper.FileHelper; +import kim.apidoc.core.render.AsciiDocRender; +import kim.apidoc.core.render.PostmanRender; +import kim.apidoc.core.render.ProjectRender; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import lombok.Getter; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/Assert.java b/apidoc-core/src/main/java/kim/apidoc/core/common/Assert.java similarity index 95% rename from apidoc-core/src/main/java/com/apidoc/core/common/Assert.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/Assert.java index 4c4bc5b..a98d17d 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/Assert.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/Assert.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common; +package kim.apidoc.core.common; import com.google.common.base.Strings; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/ObjectMappers.java b/apidoc-core/src/main/java/kim/apidoc/core/common/ObjectMappers.java similarity index 97% rename from apidoc-core/src/main/java/com/apidoc/core/common/ObjectMappers.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/ObjectMappers.java index 0f2407b..685cb26 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/ObjectMappers.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/ObjectMappers.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common; +package kim.apidoc.core.common; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.core.JsonProcessingException; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/QueryStringBuilder.java b/apidoc-core/src/main/java/kim/apidoc/core/common/QueryStringBuilder.java similarity index 96% rename from apidoc-core/src/main/java/com/apidoc/core/common/QueryStringBuilder.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/QueryStringBuilder.java index 3dd2257..9cfafa5 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/QueryStringBuilder.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/QueryStringBuilder.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common; +package kim.apidoc.core.common; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ObjectNode; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/URI.java b/apidoc-core/src/main/java/kim/apidoc/core/common/URI.java similarity index 94% rename from apidoc-core/src/main/java/com/apidoc/core/common/URI.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/URI.java index c34de99..909071c 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/URI.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/URI.java @@ -1,6 +1,6 @@ -package com.apidoc.core.common; +package kim.apidoc.core.common; -import com.apidoc.core.common.helper.StringHelper; +import kim.apidoc.core.common.helper.StringHelper; import com.google.common.collect.Lists; import lombok.EqualsAndHashCode; import lombok.Getter; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/description/ArrayTypeDescription.java b/apidoc-core/src/main/java/kim/apidoc/core/common/description/ArrayTypeDescription.java similarity index 64% rename from apidoc-core/src/main/java/com/apidoc/core/common/description/ArrayTypeDescription.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/description/ArrayTypeDescription.java index a26eb64..8359d86 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/description/ArrayTypeDescription.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/description/ArrayTypeDescription.java @@ -1,7 +1,7 @@ -package com.apidoc.core.common.description; +package kim.apidoc.core.common.description; -import com.apidoc.core.common.ObjectMappers; -import com.apidoc.core.schema.Row; +import kim.apidoc.core.common.ObjectMappers; +import kim.apidoc.core.schema.Row; import com.fasterxml.jackson.databind.node.ArrayNode; import java.util.ArrayList; @@ -15,47 +15,47 @@ public class ArrayTypeDescription extends TypeDescription { public ArrayTypeDescription(TypeDescription component) { this.component = component; this.value = ObjectMappers.instance.createArrayNode(); - if(component.isAvailable()){ + if (component.isAvailable()) { this.type = component.getType() + "[]"; - if(component.isPrimitive()){ + if (component.isPrimitive()) { primitive(component.asPrimitive()); - }else if(component.isString()){ + } else if (component.isString()) { value.add(component.asString().getValue()); - }else if(component.isArray()){ + } else if (component.isArray()) { value.add(component.asArray().getValue()); - }else if(component.isObject()){ + } else if (component.isObject()) { value.add(component.asObject().getValue()); } - }else{ + } else { this.type = "[]"; } } - public void primitive(PrimitiveTypeDescription typeDescription){ - switch (typeDescription.getType()){ + public void primitive(PrimitiveTypeDescription typeDescription) { + switch (typeDescription.getType()) { case "byte": - value.add((byte)typeDescription.getValue()); + value.add((byte) typeDescription.getValue()); break; case "short": - value.add((short)typeDescription.getValue()); + value.add((short) typeDescription.getValue()); break; case "char": - value.add((char)typeDescription.getValue()); + value.add((char) typeDescription.getValue()); break; case "int": - value.add((int)typeDescription.getValue()); + value.add((int) typeDescription.getValue()); break; case "long": - value.add((long)typeDescription.getValue()); + value.add((long) typeDescription.getValue()); break; case "boolean": - value.add((boolean)typeDescription.getValue()); + value.add((boolean) typeDescription.getValue()); break; case "float": - value.add((float)typeDescription.getValue()); + value.add((float) typeDescription.getValue()); break; case "double": - value.add((double)typeDescription.getValue()); + value.add((double) typeDescription.getValue()); break; } } @@ -76,17 +76,17 @@ public class ArrayTypeDescription extends TypeDescription { } } - public ArrayNode getValue(){ + public ArrayNode getValue() { return value; } @Override public Collection rows() { ArrayList rows = new ArrayList<>(); - if(key != null){ + if (key != null) { rows.addAll(super.rows()); } - if(component.isAvailable()){ + if (component.isAvailable()) { rows.addAll(component.rows()); } return rows; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/description/ObjectTypeDescription.java b/apidoc-core/src/main/java/kim/apidoc/core/common/description/ObjectTypeDescription.java similarity index 95% rename from apidoc-core/src/main/java/com/apidoc/core/common/description/ObjectTypeDescription.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/description/ObjectTypeDescription.java index e4a2489..f614fd1 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/description/ObjectTypeDescription.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/description/ObjectTypeDescription.java @@ -1,7 +1,7 @@ -package com.apidoc.core.common.description; +package kim.apidoc.core.common.description; -import com.apidoc.core.common.ObjectMappers; -import com.apidoc.core.schema.Row; +import kim.apidoc.core.common.ObjectMappers; +import kim.apidoc.core.schema.Row; import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.common.collect.Lists; import lombok.Getter; @@ -14,9 +14,8 @@ import java.util.List; @Getter public class ObjectTypeDescription extends TypeDescription { - private ObjectNode value = ObjectMappers.instance.createObjectNode(); - protected List members = Lists.newArrayList(); + private ObjectNode value = ObjectMappers.instance.createObjectNode(); public void merge(ObjectTypeDescription other) { value.setAll(other.getValue()); @@ -87,6 +86,7 @@ public class ObjectTypeDescription extends TypeDescription { } } + @Override public ObjectNode getValue() { return value; } diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/description/PrimitiveTypeDescription.java b/apidoc-core/src/main/java/kim/apidoc/core/common/description/PrimitiveTypeDescription.java similarity index 89% rename from apidoc-core/src/main/java/com/apidoc/core/common/description/PrimitiveTypeDescription.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/description/PrimitiveTypeDescription.java index 99d1348..0eb349e 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/description/PrimitiveTypeDescription.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/description/PrimitiveTypeDescription.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.description; +package kim.apidoc.core.common.description; import com.github.javaparser.resolution.types.ResolvedPrimitiveType; import com.github.javaparser.resolution.types.ResolvedReferenceType; @@ -6,8 +6,8 @@ import com.github.javaparser.resolution.types.ResolvedReferenceType; public class PrimitiveTypeDescription extends TypeDescription { - public PrimitiveTypeDescription(ResolvedReferenceType referenceType){ - switch (referenceType.getId()){ + public PrimitiveTypeDescription(ResolvedReferenceType referenceType) { + switch (referenceType.getId()) { case "java.lang.Byte": value = (byte) 0; type = "byte"; @@ -33,7 +33,7 @@ public class PrimitiveTypeDescription extends TypeDescription { type = "double"; break; case "java.lang.Character": - value = (char)0; + value = (char) 0; type = "char"; break; case "java.lang.Boolean": @@ -43,9 +43,10 @@ public class PrimitiveTypeDescription extends TypeDescription { } } - public PrimitiveTypeDescription(ResolvedPrimitiveType resolvedPrimitiveType){ + + public PrimitiveTypeDescription(ResolvedPrimitiveType resolvedPrimitiveType) { type = resolvedPrimitiveType.describe(); - switch (resolvedPrimitiveType){ + switch (resolvedPrimitiveType) { case BYTE: value = (byte) 0; break; @@ -65,7 +66,7 @@ public class PrimitiveTypeDescription extends TypeDescription { value = 0d; break; case CHAR: - value = (char)0; + value = (char) 0; break; case BOOLEAN: value = false; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/description/StringTypeDescription.java b/apidoc-core/src/main/java/kim/apidoc/core/common/description/StringTypeDescription.java similarity index 64% rename from apidoc-core/src/main/java/com/apidoc/core/common/description/StringTypeDescription.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/description/StringTypeDescription.java index ad56e82..f8d589b 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/description/StringTypeDescription.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/description/StringTypeDescription.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.description; +package kim.apidoc.core.common.description; public class StringTypeDescription extends TypeDescription { @@ -7,7 +7,8 @@ public class StringTypeDescription extends TypeDescription { value = charSequence.toString(); } - public String getValue(){ - return (String)value; + @Override + public String getValue() { + return (String) value; } } diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/description/TypeDescription.java b/apidoc-core/src/main/java/kim/apidoc/core/common/description/TypeDescription.java similarity index 79% rename from apidoc-core/src/main/java/com/apidoc/core/common/description/TypeDescription.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/description/TypeDescription.java index eee1377..57b7cc9 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/description/TypeDescription.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/description/TypeDescription.java @@ -1,7 +1,7 @@ -package com.apidoc.core.common.description; +package kim.apidoc.core.common.description; -import com.apidoc.core.common.helper.StringHelper; -import com.apidoc.core.schema.Row; +import kim.apidoc.core.common.helper.StringHelper; +import kim.apidoc.core.schema.Row; import com.google.common.collect.Lists; import lombok.Getter; import lombok.Setter; @@ -61,36 +61,36 @@ public abstract class TypeDescription { return (ObjectTypeDescription) this; } - public void addRemark(String value){ - if(value==null){ + public void addRemark(String value) { + if (value == null) { return; } - if(remark==null){ + if (remark == null) { remark = value; - }else{ + } else { remark += " " + value; } } - public String fullKey(){ - return StringHelper.join(".",prefix,key); + public String fullKey() { + return StringHelper.join(".", prefix, key); } public Collection rows() { String key = fullKey(); - if(StringHelper.isBlank(key)){ + if (StringHelper.isBlank(key)) { return Lists.newArrayList(); } String def; - if(defaultValue!=null){ + if (defaultValue != null) { def = String.valueOf(defaultValue); - }else if(value!=null){ + } else if (value != null) { def = String.valueOf(value); - }else{ + } else { def = ""; } - if(required!=null){ + if (required != null) { condition.append("required=").append(required); } diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/description/UnAvailableTypeDescription.java b/apidoc-core/src/main/java/kim/apidoc/core/common/description/UnAvailableTypeDescription.java similarity index 85% rename from apidoc-core/src/main/java/com/apidoc/core/common/description/UnAvailableTypeDescription.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/description/UnAvailableTypeDescription.java index 2e18b8a..d40e90e 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/description/UnAvailableTypeDescription.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/description/UnAvailableTypeDescription.java @@ -1,6 +1,6 @@ -package com.apidoc.core.common.description; +package kim.apidoc.core.common.description; -import com.apidoc.core.schema.Row; +import kim.apidoc.core.schema.Row; import java.util.Collection; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/diff/FileMatcher.java b/apidoc-core/src/main/java/kim/apidoc/core/common/diff/FileMatcher.java similarity index 96% rename from apidoc-core/src/main/java/com/apidoc/core/common/diff/FileMatcher.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/diff/FileMatcher.java index a1be9ee..52b5806 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/diff/FileMatcher.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/diff/FileMatcher.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.diff; +package kim.apidoc.core.common.diff; import com.google.common.base.Charsets; import lombok.Getter; @@ -42,7 +42,7 @@ public class FileMatcher { return changs; } - public void rederHtml(Path templateHtml, Path resultHtml) { + public void renderHtml(Path templateHtml, Path resultHtml) { String results = matchPatcher.diff_prettyHtml(diffs); String[] lines = br(results).replaceAll("|", "").split("\n"); String html = readFile(templateHtml); diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/diff/FileSystem.java b/apidoc-core/src/main/java/kim/apidoc/core/common/diff/FileSystem.java similarity index 90% rename from apidoc-core/src/main/java/com/apidoc/core/common/diff/FileSystem.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/diff/FileSystem.java index 83c9797..447274b 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/diff/FileSystem.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/diff/FileSystem.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.diff; +package kim.apidoc.core.common.diff; import java.awt.*; import java.io.File; @@ -9,7 +9,7 @@ import java.nio.file.Path; public class FileSystem { public static boolean open(Path path) { - if(!Files.exists(path)){ + if (!Files.exists(path)) { return false; } if (cmd(path.toString())) { @@ -25,8 +25,8 @@ public class FileSystem { private static boolean cmd(String command, String args) { try { - Process p = Runtime.getRuntime().exec(new String[]{command,args}); - return p!=null; + Process p = Runtime.getRuntime().exec(new String[]{command, args}); + return p != null; } catch (IOException e) { e.printStackTrace(); } @@ -45,6 +45,14 @@ public class FileSystem { return false; } + private static OS currentOS() { + String s = System.getProperty("os.name").toLowerCase(); + if (s.contains("win")) { + return OS.win; + } + return OS.mac; + } + public enum OS { mac("open"), win("explorer"); @@ -55,17 +63,9 @@ public class FileSystem { this.command = command; } - public String getCommand(){ + public String getCommand() { return command; } } - - private static OS currentOS() { - String s = System.getProperty("os.name").toLowerCase(); - if (s.contains("win")) { - return OS.win; - } - return OS.mac; - } } diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/diff/MatchPatcher.java b/apidoc-core/src/main/java/kim/apidoc/core/common/diff/MatchPatcher.java similarity index 99% rename from apidoc-core/src/main/java/com/apidoc/core/common/diff/MatchPatcher.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/diff/MatchPatcher.java index 7c2adf5..0d0da4b 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/diff/MatchPatcher.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/diff/MatchPatcher.java @@ -15,7 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.apidoc.core.common.diff; +package kim.apidoc.core.common.diff; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/helper/AnnotationHelper.java b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/AnnotationHelper.java similarity index 97% rename from apidoc-core/src/main/java/com/apidoc/core/common/helper/AnnotationHelper.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/helper/AnnotationHelper.java index ffd5a50..4304fec 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/helper/AnnotationHelper.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/AnnotationHelper.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.helper; +package kim.apidoc.core.common.helper; import com.github.javaparser.ast.expr.*; import com.github.javaparser.ast.nodeTypes.NodeWithAnnotations; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/helper/ClassDeclarationHelper.java b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/ClassDeclarationHelper.java similarity index 97% rename from apidoc-core/src/main/java/com/apidoc/core/common/helper/ClassDeclarationHelper.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/helper/ClassDeclarationHelper.java index 9ad4590..cc0a05f 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/helper/ClassDeclarationHelper.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/ClassDeclarationHelper.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.helper; +package kim.apidoc.core.common.helper; import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; import com.github.javaparser.ast.body.FieldDeclaration; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/helper/CommentHelper.java b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/CommentHelper.java similarity index 98% rename from apidoc-core/src/main/java/com/apidoc/core/common/helper/CommentHelper.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/helper/CommentHelper.java index 414216f..86234f2 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/helper/CommentHelper.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/CommentHelper.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.helper; +package kim.apidoc.core.common.helper; import com.github.javaparser.ast.body.FieldDeclaration; import com.github.javaparser.ast.body.MethodDeclaration; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/helper/CompilationUnitHelper.java b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/CompilationUnitHelper.java similarity index 92% rename from apidoc-core/src/main/java/com/apidoc/core/common/helper/CompilationUnitHelper.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/helper/CompilationUnitHelper.java index e362e99..5cd7591 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/helper/CompilationUnitHelper.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/CompilationUnitHelper.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.helper; +package kim.apidoc.core.common.helper; import com.github.javaparser.ast.CompilationUnit; import com.github.javaparser.ast.Node; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/helper/ExpressionHelper.java b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/ExpressionHelper.java similarity index 98% rename from apidoc-core/src/main/java/com/apidoc/core/common/helper/ExpressionHelper.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/helper/ExpressionHelper.java index f381b49..13adf03 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/helper/ExpressionHelper.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/ExpressionHelper.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.helper; +package kim.apidoc.core.common.helper; import com.github.javaparser.ast.NodeList; import com.github.javaparser.ast.expr.*; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/helper/FieldHelper.java b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/FieldHelper.java similarity index 97% rename from apidoc-core/src/main/java/com/apidoc/core/common/helper/FieldHelper.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/helper/FieldHelper.java index e68f3cc..fcb8c53 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/helper/FieldHelper.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/FieldHelper.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.helper; +package kim.apidoc.core.common.helper; import com.github.javaparser.ast.expr.Expression; import com.github.javaparser.resolution.declarations.ResolvedFieldDeclaration; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/helper/FileHelper.java b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/FileHelper.java similarity index 97% rename from apidoc-core/src/main/java/com/apidoc/core/common/helper/FileHelper.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/helper/FileHelper.java index 65b7ef7..7a78036 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/helper/FileHelper.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/FileHelper.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.helper; +package kim.apidoc.core.common.helper; import com.google.common.collect.Lists; import lombok.extern.slf4j.Slf4j; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/helper/JsonPropertyHelper.java b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/JsonPropertyHelper.java similarity index 97% rename from apidoc-core/src/main/java/com/apidoc/core/common/helper/JsonPropertyHelper.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/helper/JsonPropertyHelper.java index 2e8a6c1..63c748a 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/helper/JsonPropertyHelper.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/JsonPropertyHelper.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.helper; +package kim.apidoc.core.common.helper; import com.github.javaparser.ast.body.FieldDeclaration; import com.github.javaparser.ast.expr.AnnotationExpr; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/helper/OptionalHelper.java b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/OptionalHelper.java similarity index 89% rename from apidoc-core/src/main/java/com/apidoc/core/common/helper/OptionalHelper.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/helper/OptionalHelper.java index 830c9f7..661243d 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/helper/OptionalHelper.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/OptionalHelper.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.helper; +package kim.apidoc.core.common.helper; import java.util.Optional; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/helper/ReferenceContext.java b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/ReferenceContext.java similarity index 95% rename from apidoc-core/src/main/java/com/apidoc/core/common/helper/ReferenceContext.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/helper/ReferenceContext.java index fe3294d..20daa40 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/helper/ReferenceContext.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/ReferenceContext.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.helper; +package kim.apidoc.core.common.helper; import com.google.common.collect.Sets; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/helper/StringHelper.java b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/StringHelper.java similarity index 96% rename from apidoc-core/src/main/java/com/apidoc/core/common/helper/StringHelper.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/helper/StringHelper.java index 40f2e97..08e98fe 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/helper/StringHelper.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/StringHelper.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.helper; +package kim.apidoc.core.common.helper; import com.google.common.base.Strings; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/helper/TypeNameHelper.java b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/TypeNameHelper.java similarity index 97% rename from apidoc-core/src/main/java/com/apidoc/core/common/helper/TypeNameHelper.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/helper/TypeNameHelper.java index 59a42c9..38efcaf 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/helper/TypeNameHelper.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/TypeNameHelper.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.helper; +package kim.apidoc.core.common.helper; import com.github.javaparser.ast.CompilationUnit; import com.github.javaparser.ast.ImportDeclaration; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/helper/TypeParameterHelper.java b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/TypeParameterHelper.java similarity index 98% rename from apidoc-core/src/main/java/com/apidoc/core/common/helper/TypeParameterHelper.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/helper/TypeParameterHelper.java index fb055dc..722d0b0 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/helper/TypeParameterHelper.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/TypeParameterHelper.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.helper; +package kim.apidoc.core.common.helper; import com.github.javaparser.resolution.declarations.ResolvedTypeParameterDeclaration; import com.github.javaparser.resolution.types.ResolvedReferenceType; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/helper/ValidationHelper.java b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/ValidationHelper.java similarity index 97% rename from apidoc-core/src/main/java/com/apidoc/core/common/helper/ValidationHelper.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/helper/ValidationHelper.java index 7e2ccfd..0d42101 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/helper/ValidationHelper.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/ValidationHelper.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.helper; +package kim.apidoc.core.common.helper; import com.github.javaparser.ast.body.FieldDeclaration; import com.github.javaparser.ast.expr.AnnotationExpr; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/markup/MarkupBuilder.java b/apidoc-core/src/main/java/kim/apidoc/core/common/markup/MarkupBuilder.java similarity index 97% rename from apidoc-core/src/main/java/com/apidoc/core/common/markup/MarkupBuilder.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/markup/MarkupBuilder.java index 98c2aa4..0dd0a03 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/markup/MarkupBuilder.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/markup/MarkupBuilder.java @@ -1,6 +1,6 @@ -package com.apidoc.core.common.markup; +package kim.apidoc.core.common.markup; -import com.apidoc.core.common.markup.asciidoc.AsciiDocBuilder; +import kim.apidoc.core.common.markup.asciidoc.AsciiDocBuilder; import java.util.List; import java.util.function.Consumer; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/markup/asciidoc/AsciiDoc.java b/apidoc-core/src/main/java/kim/apidoc/core/common/markup/asciidoc/AsciiDoc.java similarity index 97% rename from apidoc-core/src/main/java/com/apidoc/core/common/markup/asciidoc/AsciiDoc.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/markup/asciidoc/AsciiDoc.java index db39dae..18e4ca4 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/markup/asciidoc/AsciiDoc.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/markup/asciidoc/AsciiDoc.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.markup.asciidoc; +package kim.apidoc.core.common.markup.asciidoc; public enum AsciiDoc implements CharSequence { EXTENSION(".adoc"), diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/markup/asciidoc/AsciiDocBuilder.java b/apidoc-core/src/main/java/kim/apidoc/core/common/markup/asciidoc/AsciiDocBuilder.java similarity index 98% rename from apidoc-core/src/main/java/com/apidoc/core/common/markup/asciidoc/AsciiDocBuilder.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/markup/asciidoc/AsciiDocBuilder.java index 0ba3cd6..5d95e67 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/markup/asciidoc/AsciiDocBuilder.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/markup/asciidoc/AsciiDocBuilder.java @@ -1,7 +1,7 @@ -package com.apidoc.core.common.markup.asciidoc; +package kim.apidoc.core.common.markup.asciidoc; -import com.apidoc.core.common.Assert; -import com.apidoc.core.common.markup.MarkupBuilder; +import kim.apidoc.core.common.Assert; +import kim.apidoc.core.common.markup.MarkupBuilder; import com.google.common.base.Strings; import java.util.List; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/markup/asciidoc/Color.java b/apidoc-core/src/main/java/kim/apidoc/core/common/markup/asciidoc/Color.java similarity index 95% rename from apidoc-core/src/main/java/com/apidoc/core/common/markup/asciidoc/Color.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/markup/asciidoc/Color.java index 836e8db..301f70e 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/markup/asciidoc/Color.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/markup/asciidoc/Color.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.markup.asciidoc; +package kim.apidoc.core.common.markup.asciidoc; /** * https://en.wikipedia.org/wiki/Web_colors#HTML_color_names diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/markup/markdown/Markdown.java b/apidoc-core/src/main/java/kim/apidoc/core/common/markup/markdown/Markdown.java similarity index 96% rename from apidoc-core/src/main/java/com/apidoc/core/common/markup/markdown/Markdown.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/markup/markdown/Markdown.java index f31b161..22f0014 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/markup/markdown/Markdown.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/markup/markdown/Markdown.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.markup.markdown; +package kim.apidoc.core.common.markup.markdown; public enum Markdown implements CharSequence { EXTENSION(".md"), diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/markup/markdown/MarkdownBuilder.java b/apidoc-core/src/main/java/kim/apidoc/core/common/markup/markdown/MarkdownBuilder.java similarity index 75% rename from apidoc-core/src/main/java/com/apidoc/core/common/markup/markdown/MarkdownBuilder.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/markup/markdown/MarkdownBuilder.java index d31fc05..2b012d5 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/markup/markdown/MarkdownBuilder.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/markup/markdown/MarkdownBuilder.java @@ -1,15 +1,13 @@ -package com.apidoc.core.common.markup.markdown; +package kim.apidoc.core.common.markup.markdown; -import com.apidoc.core.common.Assert; -import com.apidoc.core.common.markup.MarkupBuilder; +import kim.apidoc.core.common.Assert; +import kim.apidoc.core.common.markup.MarkupBuilder; import com.google.common.base.Strings; import java.util.List; import java.util.function.Consumer; import java.util.regex.Matcher; -import static com.apidoc.core.common.markup.markdown.Markdown.*; - public class MarkdownBuilder implements MarkupBuilder { public static final int MAX_TITLE = 6; @@ -19,7 +17,7 @@ public class MarkdownBuilder implements MarkupBuilder { @Override public MarkupBuilder header(String text, CharSequence... attrs) { Assert.notBlank(text, "header must not be blank"); - content.append(HEADER); + content.append(Markdown.HEADER); content.append(nobr(text.trim())); br(); return this; @@ -30,7 +28,7 @@ public class MarkdownBuilder implements MarkupBuilder { Assert.notBlank(text, "header must not be blank"); Assert.between(level, 1, MAX_TITLE, "title level can not be " + level); br(); - content.append(Strings.repeat(TITLE.toString(), level + 1)).append(WHITESPACE) + content.append(Strings.repeat(Markdown.TITLE.toString(), level + 1)).append(Markdown.WHITESPACE) .append(nobr(text.trim())); br(); return this; @@ -67,35 +65,35 @@ public class MarkdownBuilder implements MarkupBuilder { @Override public MarkupBuilder note(String text) { - content.append(QUOTE); + content.append(Markdown.QUOTE); paragraph(text); return this; } @Override public MarkupBuilder tip(String text) { - content.append(QUOTE); + content.append(Markdown.QUOTE); paragraph(text); return this; } @Override public MarkupBuilder important(String text) { - content.append(QUOTE); + content.append(Markdown.QUOTE); paragraph(text); return this; } @Override public MarkupBuilder warning(String text) { - content.append(QUOTE); + content.append(Markdown.QUOTE); paragraph(text); return this; } @Override public MarkupBuilder caution(String text) { - content.append(QUOTE); + content.append(Markdown.QUOTE); paragraph(text); return this; } @@ -114,42 +112,42 @@ public class MarkdownBuilder implements MarkupBuilder { @Override public MarkupBuilder listing(Consumer consumer, CharSequence... attrs) { - return block(consumer, LISTING, attrs); + return block(consumer, Markdown.LISTING, attrs); } @Override public MarkupBuilder literal(Consumer consumer, CharSequence... attrs) { - return block(consumer, LISTING, attrs); + return block(consumer, Markdown.LISTING, attrs); } @Override public MarkupBuilder sidebar(Consumer consumer, CharSequence... attrs) { - return block(consumer, LISTING, attrs); + return block(consumer, Markdown.LISTING, attrs); } @Override public MarkupBuilder comment(Consumer consumer, CharSequence... attrs) { - return block(consumer, LISTING, attrs); + return block(consumer, Markdown.LISTING, attrs); } @Override public MarkupBuilder passthrough(Consumer consumer, CharSequence... attrs) { - return block(consumer, LISTING, attrs); + return block(consumer, Markdown.LISTING, attrs); } @Override public MarkupBuilder quote(Consumer consumer, CharSequence... attrs) { - return block(consumer, LISTING, attrs); + return block(consumer, Markdown.LISTING, attrs); } @Override public MarkupBuilder example(Consumer consumer, CharSequence... attrs) { - return block(consumer, LISTING, attrs); + return block(consumer, Markdown.LISTING, attrs); } @Override public MarkupBuilder list(String text) { - return list(text, LIST_FLAG); + return list(text, Markdown.LIST_FLAG); } @Override @@ -187,28 +185,28 @@ public class MarkdownBuilder implements MarkupBuilder { public MarkupBuilder table(List> data, boolean header, boolean footer) { for (int i = 0; i < data.size(); i++) { - content.append(TABLE_CELL); + content.append(Markdown.TABLE_CELL); for (int j = 0; j < data.get(i).size(); j++) { String value = data.get(i).get(j); if(value!=null){ - content.append(data.get(i).get(j).replace(TABLE_CELL, "\\" + TABLE_CELL)); + content.append(data.get(i).get(j).replace(Markdown.TABLE_CELL, "\\" + Markdown.TABLE_CELL)); }else{ content.append(" "); } - content.append(TABLE_CELL); + content.append(Markdown.TABLE_CELL); } br(); if(i==0 && header){ - content.append(TABLE_CELL); + content.append(Markdown.TABLE_CELL); for (int j = 0; j < data.get(i).size(); j++) { - content.append(TABLE_Header); + content.append(Markdown.TABLE_Header); } br(); } if(i==data.size()-2 && footer){ - content.append(TABLE_CELL); + content.append(Markdown.TABLE_CELL); for (int j = 0; j < data.get(i).size(); j++) { - content.append(TABLE_Header); + content.append(Markdown.TABLE_Header); } br(); } @@ -231,55 +229,55 @@ public class MarkdownBuilder implements MarkupBuilder { @Override public MarkupBuilder emphasized(String text, CharSequence... textStyle) { - return style(EMPHASIZED, text, textStyle); + return style(Markdown.EMPHASIZED, text, textStyle); } @Override public MarkupBuilder strong(String text, CharSequence... textStyle) { - return style(STRONG, text, textStyle); + return style(Markdown.STRONG, text, textStyle); } @Override public MarkupBuilder monospaced(String text, CharSequence... textStyle) { - return style(MONOSPACED, text, textStyle); + return style(Markdown.MONOSPACED, text, textStyle); } @Override public MarkupBuilder quoted(String text, CharSequence... textStyle) { - return style(QUOTE, text, textStyle); + return style(Markdown.QUOTE, text, textStyle); } @Override public MarkupBuilder doubleQuoted(String text, CharSequence... textStyle) { - return style(DOUBLE_QUOTED, text, textStyle); + return style(Markdown.DOUBLE_QUOTED, text, textStyle); } @Override public MarkupBuilder unquoted(String text, CharSequence... textStyle) { - return style(UNQUOTED, text, textStyle); + return style(Markdown.UNQUOTED, text, textStyle); } @Override public MarkupBuilder br() { - content.append(BR); + content.append(Markdown.BR); return this; } @Override public MarkupBuilder hbr() { - content.append(HBR); + content.append(Markdown.HBR); return this; } @Override public MarkupBuilder newLine() { - content.append(NEW_LINE); + content.append(Markdown.NEW_LINE); return this; } @Override public MarkupBuilder pageBreak() { - content.append(PAGEBREAKS); + content.append(Markdown.PAGEBREAKS); br(); return this; } @@ -298,8 +296,8 @@ public class MarkdownBuilder implements MarkupBuilder { if (Assert.isBlank(content)) { return content; } - return content.replaceAll(BR.toString(), - Matcher.quoteReplacement(WHITESPACE.toString())); + return content.replaceAll(Markdown.BR.toString(), + Matcher.quoteReplacement(Markdown.WHITESPACE.toString())); } } diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/postman/Body.java b/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Body.java similarity index 87% rename from apidoc-core/src/main/java/com/apidoc/core/common/postman/Body.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/postman/Body.java index 810f971..47487e5 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/postman/Body.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Body.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.postman; +package kim.apidoc.core.common.postman; import lombok.Getter; import lombok.Setter; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/postman/BodyMode.java b/apidoc-core/src/main/java/kim/apidoc/core/common/postman/BodyMode.java similarity index 71% rename from apidoc-core/src/main/java/com/apidoc/core/common/postman/BodyMode.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/postman/BodyMode.java index 19bbd0e..7d56b3c 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/postman/BodyMode.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/postman/BodyMode.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.postman; +package kim.apidoc.core.common.postman; /** * 对应postman定义的mode diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/postman/Folder.java b/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Folder.java similarity index 88% rename from apidoc-core/src/main/java/com/apidoc/core/common/postman/Folder.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/postman/Folder.java index 2634775..8620ef9 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/postman/Folder.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Folder.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.postman; +package kim.apidoc.core.common.postman; import com.fasterxml.jackson.annotation.JsonInclude; import lombok.Getter; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/postman/Info.java b/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Info.java similarity index 86% rename from apidoc-core/src/main/java/com/apidoc/core/common/postman/Info.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/postman/Info.java index f53cbc8..5fceb85 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/postman/Info.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Info.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.postman; +package kim.apidoc.core.common.postman; import lombok.Getter; import lombok.Setter; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/postman/Item.java b/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Item.java similarity index 89% rename from apidoc-core/src/main/java/com/apidoc/core/common/postman/Item.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/postman/Item.java index 6473b40..4a25b19 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/postman/Item.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Item.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.postman; +package kim.apidoc.core.common.postman; import lombok.Getter; import lombok.Setter; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/postman/Parameter.java b/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Parameter.java similarity index 86% rename from apidoc-core/src/main/java/com/apidoc/core/common/postman/Parameter.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/postman/Parameter.java index adc2cfb..5f3baf7 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/postman/Parameter.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Parameter.java @@ -1,7 +1,7 @@ -package com.apidoc.core.common.postman; +package kim.apidoc.core.common.postman; -import com.apidoc.core.schema.Row; +import kim.apidoc.core.schema.Row; import lombok.Getter; import lombok.Setter; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/postman/Postman.java b/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Postman.java similarity index 89% rename from apidoc-core/src/main/java/com/apidoc/core/common/postman/Postman.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/postman/Postman.java index 3fac52a..549e7a9 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/postman/Postman.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Postman.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.postman; +package kim.apidoc.core.common.postman; import lombok.Getter; import lombok.Setter; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/postman/Request.java b/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Request.java similarity index 70% rename from apidoc-core/src/main/java/com/apidoc/core/common/postman/Request.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/postman/Request.java index 8aa7db8..6ddf403 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/postman/Request.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Request.java @@ -1,7 +1,7 @@ -package com.apidoc.core.common.postman; +package kim.apidoc.core.common.postman; -import com.apidoc.core.schema.Header; -import com.apidoc.core.schema.Method; +import kim.apidoc.core.schema.Header; +import kim.apidoc.core.schema.Method; import lombok.Getter; import lombok.Setter; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/postman/Response.java b/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Response.java similarity index 81% rename from apidoc-core/src/main/java/com/apidoc/core/common/postman/Response.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/postman/Response.java index bec12b1..3854cda 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/postman/Response.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Response.java @@ -1,6 +1,6 @@ -package com.apidoc.core.common.postman; +package kim.apidoc.core.common.postman; -import com.apidoc.core.schema.Header; +import kim.apidoc.core.schema.Header; import lombok.Getter; import lombok.Setter; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/postman/Url.java b/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Url.java similarity index 87% rename from apidoc-core/src/main/java/com/apidoc/core/common/postman/Url.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/postman/Url.java index b1925f6..5fc565d 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/postman/Url.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Url.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.postman; +package kim.apidoc.core.common.postman; import lombok.Getter; import lombok.Setter; diff --git a/apidoc-core/src/main/java/com/apidoc/core/parser/ParserStrategy.java b/apidoc-core/src/main/java/kim/apidoc/core/parser/ParserStrategy.java similarity index 90% rename from apidoc-core/src/main/java/com/apidoc/core/parser/ParserStrategy.java rename to apidoc-core/src/main/java/kim/apidoc/core/parser/ParserStrategy.java index 4f88c3c..699a3a0 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/parser/ParserStrategy.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/parser/ParserStrategy.java @@ -1,7 +1,7 @@ -package com.apidoc.core.parser; +package kim.apidoc.core.parser; -import com.apidoc.core.schema.Chapter; -import com.apidoc.core.schema.Section; +import kim.apidoc.core.schema.Chapter; +import kim.apidoc.core.schema.Section; import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; import com.github.javaparser.ast.body.MethodDeclaration; diff --git a/apidoc-core/src/main/java/com/apidoc/core/parser/VisitorParser.java b/apidoc-core/src/main/java/kim/apidoc/core/parser/VisitorParser.java similarity index 87% rename from apidoc-core/src/main/java/com/apidoc/core/parser/VisitorParser.java rename to apidoc-core/src/main/java/kim/apidoc/core/parser/VisitorParser.java index 0fb2578..bcc4817 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/parser/VisitorParser.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/parser/VisitorParser.java @@ -1,10 +1,10 @@ -package com.apidoc.core.parser; +package kim.apidoc.core.parser; -import com.apidoc.core.common.helper.OptionalHelper; -import com.apidoc.core.schema.Chapter; -import com.apidoc.core.schema.Node; -import com.apidoc.core.schema.Project; -import com.apidoc.core.schema.Section; +import kim.apidoc.core.common.helper.OptionalHelper; +import kim.apidoc.core.schema.Chapter; +import kim.apidoc.core.schema.Node; +import kim.apidoc.core.schema.Project; +import kim.apidoc.core.schema.Section; import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; import com.github.javaparser.ast.body.MethodDeclaration; import com.github.javaparser.ast.visitor.VoidVisitorAdapter; diff --git a/apidoc-core/src/main/java/com/apidoc/core/render/AsciiDocRender.java b/apidoc-core/src/main/java/kim/apidoc/core/render/AsciiDocRender.java similarity index 94% rename from apidoc-core/src/main/java/com/apidoc/core/render/AsciiDocRender.java rename to apidoc-core/src/main/java/kim/apidoc/core/render/AsciiDocRender.java index 61f75df..c1e7b24 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/render/AsciiDocRender.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/render/AsciiDocRender.java @@ -1,12 +1,12 @@ -package com.apidoc.core.render; - -import com.apidoc.core.ApiDoc; -import com.apidoc.core.common.helper.FileHelper; -import com.apidoc.core.common.helper.StringHelper; -import com.apidoc.core.common.markup.MarkupBuilder; -import com.apidoc.core.common.markup.asciidoc.AsciiDoc; -import com.apidoc.core.schema.*; +package kim.apidoc.core.render; + +import kim.apidoc.core.ApiDoc; +import kim.apidoc.core.common.helper.FileHelper; +import kim.apidoc.core.common.helper.StringHelper; +import kim.apidoc.core.common.markup.MarkupBuilder; +import kim.apidoc.core.common.markup.asciidoc.AsciiDoc; import com.google.common.collect.Lists; +import kim.apidoc.core.schema.*; import lombok.extern.slf4j.Slf4j; import org.asciidoctor.Asciidoctor; import org.asciidoctor.AttributesBuilder; diff --git a/apidoc-core/src/main/java/kim/apidoc/core/render/MarkdownRender.java b/apidoc-core/src/main/java/kim/apidoc/core/render/MarkdownRender.java new file mode 100644 index 0000000..739d24a --- /dev/null +++ b/apidoc-core/src/main/java/kim/apidoc/core/render/MarkdownRender.java @@ -0,0 +1,18 @@ +package kim.apidoc.core.render; + +import kim.apidoc.core.schema.Project; + +/** + * 生成markdown api文档 + * + * @author duanledexianxianxian + * @version 1.0.0 + * @date 2020 /3/26 19:03 + * @since 1.0.0 + */ +public class MarkdownRender implements ProjectRender { + @Override + public void render(Project project) { + + } +} diff --git a/apidoc-core/src/main/java/com/apidoc/core/render/PostmanRender.java b/apidoc-core/src/main/java/kim/apidoc/core/render/PostmanRender.java similarity index 94% rename from apidoc-core/src/main/java/com/apidoc/core/render/PostmanRender.java rename to apidoc-core/src/main/java/kim/apidoc/core/render/PostmanRender.java index 64a5b63..1afe2df 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/render/PostmanRender.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/render/PostmanRender.java @@ -1,11 +1,11 @@ -package com.apidoc.core.render; +package kim.apidoc.core.render; -import com.apidoc.core.ApiDoc; -import com.apidoc.core.common.ObjectMappers; -import com.apidoc.core.common.helper.FileHelper; -import com.apidoc.core.common.postman.*; -import com.apidoc.core.schema.*; import com.fasterxml.jackson.databind.node.ObjectNode; +import kim.apidoc.core.ApiDoc; +import kim.apidoc.core.common.ObjectMappers; +import kim.apidoc.core.common.helper.FileHelper; +import kim.apidoc.core.common.postman.*; +import kim.apidoc.core.schema.*; import lombok.extern.slf4j.Slf4j; import java.nio.file.Path; diff --git a/apidoc-core/src/main/java/com/apidoc/core/render/ProjectRender.java b/apidoc-core/src/main/java/kim/apidoc/core/render/ProjectRender.java similarity index 74% rename from apidoc-core/src/main/java/com/apidoc/core/render/ProjectRender.java rename to apidoc-core/src/main/java/kim/apidoc/core/render/ProjectRender.java index b1541f6..2e12666 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/render/ProjectRender.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/render/ProjectRender.java @@ -1,6 +1,6 @@ -package com.apidoc.core.render; +package kim.apidoc.core.render; -import com.apidoc.core.schema.Project; +import kim.apidoc.core.schema.Project; /** * The interface Project render. diff --git a/apidoc-core/src/main/java/com/apidoc/core/resolver/ArrayTypeResolver.java b/apidoc-core/src/main/java/kim/apidoc/core/resolver/ArrayTypeResolver.java similarity index 69% rename from apidoc-core/src/main/java/com/apidoc/core/resolver/ArrayTypeResolver.java rename to apidoc-core/src/main/java/kim/apidoc/core/resolver/ArrayTypeResolver.java index 55c4ba8..db9e2c6 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/resolver/ArrayTypeResolver.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/resolver/ArrayTypeResolver.java @@ -1,8 +1,8 @@ -package com.apidoc.core.resolver; +package kim.apidoc.core.resolver; -import com.apidoc.core.ApiDoc; -import com.apidoc.core.common.description.TypeDescription; -import com.apidoc.core.common.description.ArrayTypeDescription; +import kim.apidoc.core.ApiDoc; +import kim.apidoc.core.common.description.TypeDescription; +import kim.apidoc.core.common.description.ArrayTypeDescription; import com.github.javaparser.resolution.types.ResolvedType; public class ArrayTypeResolver implements TypeResolver { diff --git a/apidoc-core/src/main/java/com/apidoc/core/resolver/CollectionTypeResolver.java b/apidoc-core/src/main/java/kim/apidoc/core/resolver/CollectionTypeResolver.java similarity index 80% rename from apidoc-core/src/main/java/com/apidoc/core/resolver/CollectionTypeResolver.java rename to apidoc-core/src/main/java/kim/apidoc/core/resolver/CollectionTypeResolver.java index 2723e0d..89e6356 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/resolver/CollectionTypeResolver.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/resolver/CollectionTypeResolver.java @@ -1,10 +1,10 @@ -package com.apidoc.core.resolver; +package kim.apidoc.core.resolver; -import com.apidoc.core.ApiDoc; -import com.apidoc.core.common.helper.TypeParameterHelper; -import com.apidoc.core.common.description.ArrayTypeDescription; -import com.apidoc.core.common.description.TypeDescription; -import com.apidoc.core.common.description.UnAvailableTypeDescription; +import kim.apidoc.core.ApiDoc; +import kim.apidoc.core.common.helper.TypeParameterHelper; +import kim.apidoc.core.common.description.ArrayTypeDescription; +import kim.apidoc.core.common.description.TypeDescription; +import kim.apidoc.core.common.description.UnAvailableTypeDescription; import com.github.javaparser.resolution.types.ResolvedType; import com.google.common.collect.ImmutableList; diff --git a/apidoc-core/src/main/java/com/apidoc/core/resolver/DateTypeResolver.java b/apidoc-core/src/main/java/kim/apidoc/core/resolver/DateTypeResolver.java similarity index 84% rename from apidoc-core/src/main/java/com/apidoc/core/resolver/DateTypeResolver.java rename to apidoc-core/src/main/java/kim/apidoc/core/resolver/DateTypeResolver.java index 93cfad1..b163b84 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/resolver/DateTypeResolver.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/resolver/DateTypeResolver.java @@ -1,7 +1,7 @@ -package com.apidoc.core.resolver; +package kim.apidoc.core.resolver; -import com.apidoc.core.common.description.TypeDescription; -import com.apidoc.core.common.description.StringTypeDescription; +import kim.apidoc.core.common.description.TypeDescription; +import kim.apidoc.core.common.description.StringTypeDescription; import com.github.javaparser.resolution.types.ResolvedType; import com.google.common.collect.ImmutableList; diff --git a/apidoc-core/src/main/java/com/apidoc/core/resolver/EnumTypeResolver.java b/apidoc-core/src/main/java/kim/apidoc/core/resolver/EnumTypeResolver.java similarity index 85% rename from apidoc-core/src/main/java/com/apidoc/core/resolver/EnumTypeResolver.java rename to apidoc-core/src/main/java/kim/apidoc/core/resolver/EnumTypeResolver.java index 3863c13..6138033 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/resolver/EnumTypeResolver.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/resolver/EnumTypeResolver.java @@ -1,7 +1,7 @@ -package com.apidoc.core.resolver; +package kim.apidoc.core.resolver; -import com.apidoc.core.common.description.StringTypeDescription; -import com.apidoc.core.common.description.TypeDescription; +import kim.apidoc.core.common.description.StringTypeDescription; +import kim.apidoc.core.common.description.TypeDescription; import com.github.javaparser.resolution.declarations.ResolvedEnumConstantDeclaration; import com.github.javaparser.resolution.declarations.ResolvedEnumDeclaration; import com.github.javaparser.resolution.types.ResolvedType; diff --git a/apidoc-core/src/main/java/com/apidoc/core/resolver/MapTypeResolver.java b/apidoc-core/src/main/java/kim/apidoc/core/resolver/MapTypeResolver.java similarity index 73% rename from apidoc-core/src/main/java/com/apidoc/core/resolver/MapTypeResolver.java rename to apidoc-core/src/main/java/kim/apidoc/core/resolver/MapTypeResolver.java index 2855dcd..9cba7e1 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/resolver/MapTypeResolver.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/resolver/MapTypeResolver.java @@ -1,7 +1,7 @@ -package com.apidoc.core.resolver; +package kim.apidoc.core.resolver; -import com.apidoc.core.common.description.TypeDescription; -import com.apidoc.core.common.description.UnAvailableTypeDescription; +import kim.apidoc.core.common.description.TypeDescription; +import kim.apidoc.core.common.description.UnAvailableTypeDescription; import com.github.javaparser.resolution.types.ResolvedType; import com.google.common.collect.ImmutableList; @@ -9,24 +9,14 @@ import com.google.common.collect.ImmutableList; * 不支持直接使用Map,建议使用DTO */ public class MapTypeResolver implements TypeResolver { - @Override - public boolean accept(ResolvedType type) { - return isMap(type); - } - - @Override - public TypeDescription resolve(ResolvedType type) { - return new UnAvailableTypeDescription(); - } - - private static boolean isMap(ResolvedType type){ - if(!type.isReferenceType()){ + private static boolean isMap(ResolvedType type) { + if (!type.isReferenceType()) { return false; } return isMap(type.asReferenceType().getId()); } - private static boolean isMap(String id){ + private static boolean isMap(String id) { return ImmutableList.of("java.util.Map", "java.util.HashMap", "java.util.Hashtable", @@ -35,4 +25,14 @@ public class MapTypeResolver implements TypeResolver { "java.lang.TreeMap" ).contains(id); } + + @Override + public boolean accept(ResolvedType type) { + return isMap(type); + } + + @Override + public TypeDescription resolve(ResolvedType type) { + return new UnAvailableTypeDescription(); + } } diff --git a/apidoc-core/src/main/java/com/apidoc/core/resolver/ObjectTypeResolver.java b/apidoc-core/src/main/java/kim/apidoc/core/resolver/ObjectTypeResolver.java similarity index 93% rename from apidoc-core/src/main/java/com/apidoc/core/resolver/ObjectTypeResolver.java rename to apidoc-core/src/main/java/kim/apidoc/core/resolver/ObjectTypeResolver.java index 8117ea2..b9302f9 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/resolver/ObjectTypeResolver.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/resolver/ObjectTypeResolver.java @@ -1,12 +1,12 @@ -package com.apidoc.core.resolver; +package kim.apidoc.core.resolver; -import com.apidoc.core.ApiDoc; -import com.apidoc.core.common.description.ObjectTypeDescription; -import com.apidoc.core.common.description.TypeDescription; -import com.apidoc.core.common.helper.*; import com.github.javaparser.resolution.declarations.ResolvedFieldDeclaration; import com.github.javaparser.resolution.types.ResolvedReferenceType; import com.github.javaparser.resolution.types.ResolvedType; +import kim.apidoc.core.ApiDoc; +import kim.apidoc.core.common.description.ObjectTypeDescription; +import kim.apidoc.core.common.description.TypeDescription; +import kim.apidoc.core.common.helper.*; import java.util.Optional; diff --git a/apidoc-core/src/main/java/com/apidoc/core/resolver/PrimitiveTypeResolver.java b/apidoc-core/src/main/java/kim/apidoc/core/resolver/PrimitiveTypeResolver.java similarity index 87% rename from apidoc-core/src/main/java/com/apidoc/core/resolver/PrimitiveTypeResolver.java rename to apidoc-core/src/main/java/kim/apidoc/core/resolver/PrimitiveTypeResolver.java index 790beda..cdd456b 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/resolver/PrimitiveTypeResolver.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/resolver/PrimitiveTypeResolver.java @@ -1,7 +1,7 @@ -package com.apidoc.core.resolver; +package kim.apidoc.core.resolver; -import com.apidoc.core.common.description.PrimitiveTypeDescription; -import com.apidoc.core.common.description.TypeDescription; +import kim.apidoc.core.common.description.PrimitiveTypeDescription; +import kim.apidoc.core.common.description.TypeDescription; import com.github.javaparser.resolution.types.ResolvedType; import com.google.common.collect.ImmutableList; diff --git a/apidoc-core/src/main/java/com/apidoc/core/resolver/StringTypeResolver.java b/apidoc-core/src/main/java/kim/apidoc/core/resolver/StringTypeResolver.java similarity index 82% rename from apidoc-core/src/main/java/com/apidoc/core/resolver/StringTypeResolver.java rename to apidoc-core/src/main/java/kim/apidoc/core/resolver/StringTypeResolver.java index 4557b44..b2942c4 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/resolver/StringTypeResolver.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/resolver/StringTypeResolver.java @@ -1,7 +1,7 @@ -package com.apidoc.core.resolver; +package kim.apidoc.core.resolver; -import com.apidoc.core.common.description.TypeDescription; -import com.apidoc.core.common.description.StringTypeDescription; +import kim.apidoc.core.common.description.TypeDescription; +import kim.apidoc.core.common.description.StringTypeDescription; import com.github.javaparser.resolution.types.ResolvedType; import com.google.common.collect.ImmutableList; diff --git a/apidoc-core/src/main/java/com/apidoc/core/resolver/SystemObjectTypeResolver.java b/apidoc-core/src/main/java/kim/apidoc/core/resolver/SystemObjectTypeResolver.java similarity index 81% rename from apidoc-core/src/main/java/com/apidoc/core/resolver/SystemObjectTypeResolver.java rename to apidoc-core/src/main/java/kim/apidoc/core/resolver/SystemObjectTypeResolver.java index fabfa40..5fe5e56 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/resolver/SystemObjectTypeResolver.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/resolver/SystemObjectTypeResolver.java @@ -1,7 +1,7 @@ -package com.apidoc.core.resolver; +package kim.apidoc.core.resolver; -import com.apidoc.core.common.description.TypeDescription; -import com.apidoc.core.common.description.UnAvailableTypeDescription; +import kim.apidoc.core.common.description.TypeDescription; +import kim.apidoc.core.common.description.UnAvailableTypeDescription; import com.github.javaparser.resolution.types.ResolvedType; public class SystemObjectTypeResolver implements TypeResolver { diff --git a/apidoc-core/src/main/java/com/apidoc/core/resolver/TypeNameResolver.java b/apidoc-core/src/main/java/kim/apidoc/core/resolver/TypeNameResolver.java similarity index 62% rename from apidoc-core/src/main/java/com/apidoc/core/resolver/TypeNameResolver.java rename to apidoc-core/src/main/java/kim/apidoc/core/resolver/TypeNameResolver.java index ae5c4e0..7a12503 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/resolver/TypeNameResolver.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/resolver/TypeNameResolver.java @@ -1,6 +1,6 @@ -package com.apidoc.core.resolver; +package kim.apidoc.core.resolver; -import com.apidoc.core.common.description.TypeDescription; +import kim.apidoc.core.common.description.TypeDescription; import com.github.javaparser.ast.type.Type; public interface TypeNameResolver { diff --git a/apidoc-core/src/main/java/com/apidoc/core/resolver/TypeResolver.java b/apidoc-core/src/main/java/kim/apidoc/core/resolver/TypeResolver.java similarity index 66% rename from apidoc-core/src/main/java/com/apidoc/core/resolver/TypeResolver.java rename to apidoc-core/src/main/java/kim/apidoc/core/resolver/TypeResolver.java index ce68789..469a691 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/resolver/TypeResolver.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/resolver/TypeResolver.java @@ -1,6 +1,6 @@ -package com.apidoc.core.resolver; +package kim.apidoc.core.resolver; -import com.apidoc.core.common.description.TypeDescription; +import kim.apidoc.core.common.description.TypeDescription; import com.github.javaparser.resolution.types.ResolvedType; public interface TypeResolver { diff --git a/apidoc-core/src/main/java/com/apidoc/core/resolver/TypeResolvers.java b/apidoc-core/src/main/java/kim/apidoc/core/resolver/TypeResolvers.java similarity index 92% rename from apidoc-core/src/main/java/com/apidoc/core/resolver/TypeResolvers.java rename to apidoc-core/src/main/java/kim/apidoc/core/resolver/TypeResolvers.java index 4b5ca96..fc8a6b1 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/resolver/TypeResolvers.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/resolver/TypeResolvers.java @@ -1,8 +1,8 @@ -package com.apidoc.core.resolver; +package kim.apidoc.core.resolver; -import com.apidoc.core.common.description.TypeDescription; -import com.apidoc.core.common.helper.TypeNameHelper; -import com.apidoc.core.common.description.UnAvailableTypeDescription; +import kim.apidoc.core.common.description.TypeDescription; +import kim.apidoc.core.common.helper.TypeNameHelper; +import kim.apidoc.core.common.description.UnAvailableTypeDescription; import com.github.javaparser.ast.type.Type; import com.github.javaparser.resolution.UnsolvedSymbolException; import com.github.javaparser.resolution.types.ResolvedType; diff --git a/apidoc-core/src/main/java/com/apidoc/core/schema/Book.java b/apidoc-core/src/main/java/kim/apidoc/core/schema/Book.java similarity index 54% rename from apidoc-core/src/main/java/com/apidoc/core/schema/Book.java rename to apidoc-core/src/main/java/kim/apidoc/core/schema/Book.java index 02f0151..99b9edd 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/schema/Book.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/schema/Book.java @@ -1,4 +1,4 @@ -package com.apidoc.core.schema; +package kim.apidoc.core.schema; import lombok.Getter; import lombok.Setter; @@ -6,14 +6,31 @@ import lombok.Setter; import java.util.Set; import java.util.TreeSet; +/** + * The type Book. + * + * @author fengyuchenglun + * @version 1.0.0 + */ @Setter @Getter public class Book extends Node { + /** + * The constant DEFAULT. + */ public static final String DEFAULT = "index"; + /** + * 章 + */ Set chapters = new TreeSet<>(); + /** + * Instantiates a new Book. + * + * @param id the id + */ public Book(String id) { this.id = id; } diff --git a/apidoc-core/src/main/java/com/apidoc/core/schema/Chapter.java b/apidoc-core/src/main/java/kim/apidoc/core/schema/Chapter.java similarity index 62% rename from apidoc-core/src/main/java/com/apidoc/core/schema/Chapter.java rename to apidoc-core/src/main/java/kim/apidoc/core/schema/Chapter.java index 1020979..59e699d 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/schema/Chapter.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/schema/Chapter.java @@ -1,4 +1,4 @@ -package com.apidoc.core.schema; +package kim.apidoc.core.schema; import lombok.Getter; import lombok.Setter; @@ -8,13 +8,22 @@ import java.util.TreeSet; /** * 章,一个类解析为一章 + * + * @author fengyuchenglun + * @version 1.0.0 */ @Setter @Getter public class Chapter extends Node { + /** + * The Book name. + */ String bookName; + /** + * The Sections. + */ Set
sections = new TreeSet<>(); } diff --git a/apidoc-core/src/main/java/kim/apidoc/core/schema/Header.java b/apidoc-core/src/main/java/kim/apidoc/core/schema/Header.java new file mode 100644 index 0000000..962f0f2 --- /dev/null +++ b/apidoc-core/src/main/java/kim/apidoc/core/schema/Header.java @@ -0,0 +1,72 @@ +package kim.apidoc.core.schema; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +/** + * The type Header. + * + * @author fengyuchenglun + * @version 1.0.0 + */ +@Setter +@Getter +@NoArgsConstructor +public class Header { + + /** + * The constant APPLICATION_JSON. + */ + public static final Header APPLICATION_JSON = new Header("Content-Type", "application/json"); + /** + * The constant X_FORM_WWW_URLENCODED. + */ + public static final Header X_FORM_WWW_URLENCODED = new Header("Content-Type", "x-www-form-urlencoded"); + + /** + * The Key. + */ + String key; + /** + * The Value. + */ + String value; + /** + * The Description. + */ + String description; + + /** + * Instantiates a new Header. + * + * @param key the key + * @param value the value + */ + public Header(String key, String value) { + this.key = key; + this.value = value; + } + + /** + * Value of header. + * + * @param text the text + * @return the header + */ + public static Header valueOf(String text) { + String[] arr = text.split(":"); + Header header = new Header(); + header.setKey(arr[0]); + if (arr.length > 1) { + header.setValue(arr[1]); + } + return header; + } + + @Override + public String toString() { + return key + ": " + value; + } + +} diff --git a/apidoc-core/src/main/java/kim/apidoc/core/schema/Method.java b/apidoc-core/src/main/java/kim/apidoc/core/schema/Method.java new file mode 100644 index 0000000..4cf18f6 --- /dev/null +++ b/apidoc-core/src/main/java/kim/apidoc/core/schema/Method.java @@ -0,0 +1,84 @@ +package kim.apidoc.core.schema; + +import lombok.extern.slf4j.Slf4j; + +/** + * 支持的http method + * @author fengyuchenglun + */ +@Slf4j +public enum Method { + + + /** + * Get method. + */ + GET, + /** + * Post method. + */ + POST, + /** + * Put method. + */ + PUT, + /** + * Delete method. + */ + DELETE, + /** + * Options method. + */ + OPTIONS, + /** + * Patch method. + */ + PATCH, + /** + * Copy method. + */ + COPY, + /** + * Head method. + */ + HEAD, + /** + * Link method. + */ + LINK, + /** + * Unlink method. + */ + UNLINK, + /** + * Purge method. + */ + PURGE, + /** + * Lock method. + */ + LOCK, + /** + * Unlock method. + */ + UNLOCK, + /** + * Propfind method. + */ + PROPFIND, + /** + * View method. + */ + VIEW; + + /** + * Of method. + * + * @param name the name + * @return the method + */ + public static Method of(String name) { + return valueOf(name); + } + +} diff --git a/apidoc-core/src/main/java/com/apidoc/core/schema/Node.java b/apidoc-core/src/main/java/kim/apidoc/core/schema/Node.java similarity index 95% rename from apidoc-core/src/main/java/com/apidoc/core/schema/Node.java rename to apidoc-core/src/main/java/kim/apidoc/core/schema/Node.java index 8ebcefe..0abf6c1 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/schema/Node.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/schema/Node.java @@ -1,8 +1,8 @@ -package com.apidoc.core.schema; +package kim.apidoc.core.schema; -import com.apidoc.core.Context; -import com.apidoc.core.common.helper.CommentHelper; -import com.apidoc.core.common.helper.StringHelper; +import kim.apidoc.core.Context; +import kim.apidoc.core.common.helper.CommentHelper; +import kim.apidoc.core.common.helper.StringHelper; import com.github.javaparser.ast.comments.Comment; import com.github.javaparser.javadoc.Javadoc; import lombok.Getter; diff --git a/apidoc-core/src/main/java/com/apidoc/core/schema/Project.java b/apidoc-core/src/main/java/kim/apidoc/core/schema/Project.java similarity index 89% rename from apidoc-core/src/main/java/com/apidoc/core/schema/Project.java rename to apidoc-core/src/main/java/kim/apidoc/core/schema/Project.java index 5935f68..6cbf3fb 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/schema/Project.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/schema/Project.java @@ -1,4 +1,4 @@ -package com.apidoc.core.schema; +package kim.apidoc.core.schema; import lombok.Getter; import lombok.Setter; @@ -31,7 +31,7 @@ public class Project extends Node { * @param chapter the chapter */ public void addChapter(Chapter chapter) { - if(Objects.isNull(chapter.getBookName())){ + if (Objects.isNull(chapter.getBookName())) { chapter.setBookName(Book.DEFAULT); } if (!books.containsKey(chapter.getBookName())) { diff --git a/apidoc-core/src/main/java/kim/apidoc/core/schema/Row.java b/apidoc-core/src/main/java/kim/apidoc/core/schema/Row.java new file mode 100644 index 0000000..b3ea98b --- /dev/null +++ b/apidoc-core/src/main/java/kim/apidoc/core/schema/Row.java @@ -0,0 +1,48 @@ +package kim.apidoc.core.schema; + +import lombok.*; + +/** + * The type Row. + * + * @author fengyuchenglun + * @version 1.0.0 + */ +@EqualsAndHashCode +@NoArgsConstructor +@AllArgsConstructor +@Setter +@Getter +public class Row { + + /** + * The Key. + */ + String key; + /** + * The Type. + */ + String type; + /** + * The Condition. + */ + String condition; + /** + * The Def. + */ + String def; + /** + * The Remark. + */ + String remark; + + /** + * Instantiates a new Row. + * + * @param type the type + */ + public Row(String type) { + this.type = type; + } + +} diff --git a/apidoc-core/src/main/java/kim/apidoc/core/schema/Section.java b/apidoc-core/src/main/java/kim/apidoc/core/schema/Section.java new file mode 100644 index 0000000..7dcff54 --- /dev/null +++ b/apidoc-core/src/main/java/kim/apidoc/core/schema/Section.java @@ -0,0 +1,198 @@ +package kim.apidoc.core.schema; + +import kim.apidoc.core.common.ObjectMappers; +import kim.apidoc.core.common.QueryStringBuilder; +import kim.apidoc.core.common.helper.StringHelper; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import lombok.Getter; +import lombok.Setter; + +import java.util.*; + +/** + * 小节,一个请求,封装为一个小节 + * + * @author fengyuchenglun + * @version 1.0.0 + */ +@Setter +@Getter +public class Section extends Node { + + /** + * The Method. + */ + Method method; + /** + * The Uri. + */ + String uri; + /** + * The In headers. + */ + Map inHeaders = new LinkedHashMap<>(); + /** + * The Path variable. + */ + ObjectNode pathVariable = ObjectMappers.instance.createObjectNode(); + /** + * The Parameter. + */ + JsonNode parameter; + /** + * The Query parameter. + */ + boolean queryParameter = true; + /** + * The Request rows. + */ + Map requestRows = new LinkedHashMap<>(); + + /** + * The Out headers. + */ + Map outHeaders = new LinkedHashMap<>(); + /** + * The Response. + */ + JsonNode response; + /** + * The Response rows. + */ + Map responseRows = new LinkedHashMap<>(); + /** + * The Raw response. + */ + Object rawResponse; + + /** + * Add request row. + * + * @param row the row + */ + public void addRequestRow(Row row) { + requestRows.put(row.getKey(), row); + } + + /** + * Add request rows. + * + * @param rows the rows + */ + public void addRequestRows(Collection rows) { + for (Row row : rows) { + if (row.getKey() != null && !requestRows.containsKey(row.getKey())) { + requestRows.put(row.getKey(), row); + } + } + } + + /** + * Get request line string. + * + * @return the string + */ + public String getRequestLine() { + StringBuilder builder = new StringBuilder(this.method.toString()); + builder.append(" ").append(this.uri); + if (this.queryParameter && Objects.equals("GET", this.method)) { + String parameterString = getParameterString(); + if (StringHelper.nonBlank(parameterString)) { + builder.append("?").append(parameterString); + } + } + builder.append(" HTTP/1.1"); + return builder.toString(); + } + + /** + * Get parameter string string. + * + * @return the string + */ + public String getParameterString() { + if (queryParameter && parameter instanceof ObjectNode) { + return new QueryStringBuilder().append((ObjectNode) parameter).toString(); + } + return ObjectMappers.pretty(parameter); + } + + /** + * Has request body boolean. + * + * @return the boolean + */ + public boolean hasRequestBody() { + if (Objects.equals("GET", this.method)) { + return false; + } + return parameter != null && parameter.size() > 0; + } + + /** + * Add response row. + * + * @param row the row + */ + public void addResponseRow(Row row) { + responseRows.put(row.getKey(), row); + } + + /** + * Add response rows. + * + * @param rows the rows + */ + public void addResponseRows(Collection rows) { + for (Row row : rows) { + if (row.getKey() != null && !responseRows.containsKey(row.getKey())) { + responseRows.put(row.getKey(), row); + } + } + } + + /** + * Has response body boolean. + * + * @return the boolean + */ + public boolean hasResponseBody() { + return response != null || rawResponse != null; + } + + /** + * Get response string string. + * + * @return the string + */ + public String getResponseString() { + if (response != null) { + return ObjectMappers.pretty(response); + } + return String.valueOf(rawResponse); + } + + /** + * Add in header. + * + * @param header the header + */ + public void addInHeader(Header header) { + if (!inHeaders.containsKey(header.getKey())) { + inHeaders.put(header.getKey(), header); + } + } + + /** + * Add out header. + * + * @param header the header + */ + public void addOutHeader(Header header) { + if (!outHeaders.containsKey(header.getKey())) { + outHeaders.put(header.getKey(), header); + } + } + +} diff --git a/apidoc-core/src/main/java/kim/apidoc/core/schema/Tag.java b/apidoc-core/src/main/java/kim/apidoc/core/schema/Tag.java new file mode 100644 index 0000000..753ae7c --- /dev/null +++ b/apidoc-core/src/main/java/kim/apidoc/core/schema/Tag.java @@ -0,0 +1,51 @@ +package kim.apidoc.core.schema; + +import lombok.Getter; +import lombok.Setter; +import lombok.extern.slf4j.Slf4j; + +import java.util.Objects; + +/** + * //@param username 用户名 + * id key content + * + * @author fengyuchenglun + * @version 1.0.0 + */ +@Slf4j +@Setter +@Getter +public class Tag { + + /** + * The Id. + */ + String id; + /** + * The Key. + */ + String key; + /** + * The Content. + */ + String content; + + /** + * Get int content int. + * + * @param def the def + * @return the int + */ + public int getIntContent(int def) { + if (Objects.nonNull(content)) { + try { + return Integer.parseInt(content); + } catch (Exception e) { + log.warn(content + " parse error"); + } + } + return def; + } + +} diff --git a/apidoc-springmvc/src/main/java/com/apigcc/springmvc/ParameterHelper.java b/apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/ParameterHelper.java similarity index 98% rename from apidoc-springmvc/src/main/java/com/apigcc/springmvc/ParameterHelper.java rename to apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/ParameterHelper.java index c45f3a8..43901de 100644 --- a/apidoc-springmvc/src/main/java/com/apigcc/springmvc/ParameterHelper.java +++ b/apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/ParameterHelper.java @@ -1,4 +1,4 @@ -package com.apigcc.springmvc; +package com.kim.apidoc.springmvc; import com.github.javaparser.ast.NodeList; import com.github.javaparser.ast.body.Parameter; diff --git a/apidoc-springmvc/src/main/java/com/apigcc/springmvc/RequestMappingHelper.java b/apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/RequestMappingHelper.java similarity index 96% rename from apidoc-springmvc/src/main/java/com/apigcc/springmvc/RequestMappingHelper.java rename to apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/RequestMappingHelper.java index 02c6afe..ba0aa40 100644 --- a/apidoc-springmvc/src/main/java/com/apigcc/springmvc/RequestMappingHelper.java +++ b/apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/RequestMappingHelper.java @@ -1,10 +1,10 @@ -package com.apigcc.springmvc; +package com.kim.apidoc.springmvc; -import com.apidoc.core.common.URI; -import com.apidoc.core.common.helper.AnnotationHelper; -import com.apidoc.core.common.helper.ClassDeclarationHelper; -import com.apidoc.core.common.helper.ExpressionHelper; -import com.apidoc.core.schema.Method; +import kim.apidoc.core.common.URI; +import kim.apidoc.core.common.helper.AnnotationHelper; +import kim.apidoc.core.common.helper.ClassDeclarationHelper; +import kim.apidoc.core.common.helper.ExpressionHelper; +import kim.apidoc.core.schema.Method; import com.github.javaparser.ast.Node; import com.github.javaparser.ast.NodeList; import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; diff --git a/apidoc-springmvc/src/main/java/com/apigcc/springmvc/SpringMVCContext.java b/apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/SpringMVCContext.java similarity index 96% rename from apidoc-springmvc/src/main/java/com/apigcc/springmvc/SpringMVCContext.java rename to apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/SpringMVCContext.java index 0b21ceb..e178cdb 100644 --- a/apidoc-springmvc/src/main/java/com/apigcc/springmvc/SpringMVCContext.java +++ b/apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/SpringMVCContext.java @@ -1,6 +1,6 @@ -package com.apigcc.springmvc; +package com.kim.apidoc.springmvc; -import com.apidoc.core.ApiDoc; +import kim.apidoc.core.ApiDoc; import com.google.common.collect.Lists; import lombok.Data; diff --git a/apidoc-springmvc/src/main/java/com/apigcc/springmvc/SpringParser.java b/apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/SpringParser.java similarity index 92% rename from apidoc-springmvc/src/main/java/com/apigcc/springmvc/SpringParser.java rename to apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/SpringParser.java index d5e04fe..091a26f 100644 --- a/apidoc-springmvc/src/main/java/com/apigcc/springmvc/SpringParser.java +++ b/apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/SpringParser.java @@ -1,18 +1,18 @@ -package com.apigcc.springmvc; - -import com.apidoc.core.ApiDoc; -import com.apidoc.core.common.URI; -import com.apidoc.core.common.description.ObjectTypeDescription; -import com.apidoc.core.common.description.TypeDescription; -import com.apidoc.core.common.helper.AnnotationHelper; -import com.apidoc.core.common.helper.ExpressionHelper; -import com.apidoc.core.common.helper.StringHelper; -import com.apidoc.core.parser.ParserStrategy; -import com.apidoc.core.schema.Chapter; -import com.apidoc.core.schema.Header; -import com.apidoc.core.schema.Row; -import com.apidoc.core.schema.Section; -import com.apigcc.springmvc.resovler.SpringComponentTypeResolver; +package com.kim.apidoc.springmvc; + +import com.kim.apidoc.springmvc.resovler.SpringComponentTypeResolver; +import kim.apidoc.core.ApiDoc; +import kim.apidoc.core.common.URI; +import kim.apidoc.core.common.description.ObjectTypeDescription; +import kim.apidoc.core.common.description.TypeDescription; +import kim.apidoc.core.common.helper.AnnotationHelper; +import kim.apidoc.core.common.helper.ExpressionHelper; +import kim.apidoc.core.common.helper.StringHelper; +import kim.apidoc.core.parser.ParserStrategy; +import kim.apidoc.core.schema.Chapter; +import kim.apidoc.core.schema.Header; +import kim.apidoc.core.schema.Row; +import kim.apidoc.core.schema.Section; import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; import com.github.javaparser.ast.body.MethodDeclaration; import com.github.javaparser.ast.body.Parameter; @@ -22,9 +22,6 @@ import com.github.javaparser.ast.expr.Expression; import java.util.List; import java.util.Optional; -import static com.apigcc.springmvc.ParameterHelper.ANNOTATION_REQUEST_HEADER; -import static com.apigcc.springmvc.ParameterHelper.ANNOTATION_REQUEST_PARAM; - /** * spring 解析 @@ -196,7 +193,7 @@ public class SpringParser implements ParserStrategy { if (ParameterHelper.isRequestHeader(parameter)) { String key = parameter.getNameAsString(); String defaultValue = "{value}"; - AnnotationExpr annotationExpr = parameter.getAnnotationByName(ANNOTATION_REQUEST_HEADER).get(); + AnnotationExpr annotationExpr = parameter.getAnnotationByName(ParameterHelper.ANNOTATION_REQUEST_HEADER).get(); Optional valueOptional = AnnotationHelper.getAnyAttribute(annotationExpr, "value", "name"); if (valueOptional.isPresent()) { key = String.valueOf(ExpressionHelper.getValue(valueOptional.get())); @@ -260,7 +257,7 @@ public class SpringParser implements ParserStrategy { Object defaultValue = null; Boolean required = null; - Optional optional = parameter.getAnnotationByName(ANNOTATION_REQUEST_PARAM); + Optional optional = parameter.getAnnotationByName(ParameterHelper.ANNOTATION_REQUEST_PARAM); if (optional.isPresent()) { Optional valueOptional = AnnotationHelper.getAnyAttribute(optional.get(), "value", "name"); if (valueOptional.isPresent()) { diff --git a/apidoc-springmvc/src/main/java/com/apigcc/springmvc/resovler/SpringComponentTypeResolver.java b/apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/resovler/SpringComponentTypeResolver.java similarity index 82% rename from apidoc-springmvc/src/main/java/com/apigcc/springmvc/resovler/SpringComponentTypeResolver.java rename to apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/resovler/SpringComponentTypeResolver.java index a589003..7132860 100644 --- a/apidoc-springmvc/src/main/java/com/apigcc/springmvc/resovler/SpringComponentTypeResolver.java +++ b/apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/resovler/SpringComponentTypeResolver.java @@ -1,11 +1,11 @@ -package com.apigcc.springmvc.resovler; - -import com.apidoc.core.ApiDoc; -import com.apidoc.core.common.description.TypeDescription; -import com.apidoc.core.common.description.UnAvailableTypeDescription; -import com.apidoc.core.common.helper.TypeParameterHelper; -import com.apidoc.core.resolver.TypeNameResolver; -import com.apidoc.core.resolver.TypeResolver; +package com.kim.apidoc.springmvc.resovler; + +import kim.apidoc.core.ApiDoc; +import kim.apidoc.core.common.description.TypeDescription; +import kim.apidoc.core.common.description.UnAvailableTypeDescription; +import kim.apidoc.core.common.helper.TypeParameterHelper; +import kim.apidoc.core.resolver.TypeNameResolver; +import kim.apidoc.core.resolver.TypeResolver; import com.github.javaparser.ast.NodeList; import com.github.javaparser.ast.type.Type; import com.github.javaparser.resolution.types.ResolvedType; diff --git a/apidoc-springmvc/src/main/resources/META-INF/services/com.apidoc.core.parser.ParserStrategy b/apidoc-springmvc/src/main/resources/META-INF/services/com.apidoc.core.parser.ParserStrategy deleted file mode 100644 index 8c48b3a..0000000 --- a/apidoc-springmvc/src/main/resources/META-INF/services/com.apidoc.core.parser.ParserStrategy +++ /dev/null @@ -1 +0,0 @@ -com.apigcc.springmvc.SpringParser \ No newline at end of file diff --git a/apidoc-springmvc/src/main/resources/META-INF/services/kim.apidoc.core.parser.ParserStrategy b/apidoc-springmvc/src/main/resources/META-INF/services/kim.apidoc.core.parser.ParserStrategy new file mode 100644 index 0000000..1867745 --- /dev/null +++ b/apidoc-springmvc/src/main/resources/META-INF/services/kim.apidoc.core.parser.ParserStrategy @@ -0,0 +1 @@ +com.kim.apidoc.springmvc.SpringParser \ No newline at end of file diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/ApigccTest.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/ApigccTest.java similarity index 85% rename from apidoc-springmvc/src/test/java/com/apigcc/example/ApigccTest.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/ApigccTest.java index 751dc72..7684aa0 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/ApigccTest.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/ApigccTest.java @@ -1,8 +1,8 @@ -package com.apigcc.example; +package com.kim.apidoc.example; -import com.apidoc.core.ApiDoc; -import com.apidoc.core.Context; +import kim.apidoc.core.ApiDoc; +import kim.apidoc.core.Context; import org.junit.Test; import java.nio.file.Paths; diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/annotation/KimController.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/annotation/KimController.java similarity index 94% rename from apidoc-springmvc/src/test/java/com/apigcc/example/annotation/KimController.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/annotation/KimController.java index 94d0e6e..1b39ec9 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/annotation/KimController.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/annotation/KimController.java @@ -1,4 +1,4 @@ -package com.apigcc.example.annotation; +package com.kim.apidoc.example.annotation; import org.springframework.stereotype.Controller; import java.lang.annotation.ElementType; diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/annotation/KimResponseBody.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/annotation/KimResponseBody.java similarity index 90% rename from apidoc-springmvc/src/test/java/com/apigcc/example/annotation/KimResponseBody.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/annotation/KimResponseBody.java index b1eef01..ae1dd64 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/annotation/KimResponseBody.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/annotation/KimResponseBody.java @@ -1,4 +1,4 @@ -package com.apigcc.example.annotation; +package com.kim.apidoc.example.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/common/Code.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/Code.java similarity index 80% rename from apidoc-springmvc/src/test/java/com/apigcc/example/common/Code.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/Code.java index 8001de8..2e75f78 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/common/Code.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/Code.java @@ -1,4 +1,4 @@ -package com.apigcc.example.common; +package com.kim.apidoc.example.common; /** * @code diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/common/Menu.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/Menu.java similarity index 74% rename from apidoc-springmvc/src/test/java/com/apigcc/example/common/Menu.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/Menu.java index 746d2ba..6d0a685 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/common/Menu.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/Menu.java @@ -1,4 +1,4 @@ -package com.apigcc.example.common; +package com.kim.apidoc.example.common; import lombok.Getter; import lombok.Setter; diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/common/Page.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/Page.java similarity index 88% rename from apidoc-springmvc/src/test/java/com/apigcc/example/common/Page.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/Page.java index 66f421f..5a467ee 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/common/Page.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/Page.java @@ -1,4 +1,4 @@ -package com.apigcc.example.common; +package com.kim.apidoc.example.common; import com.alibaba.fastjson.annotation.JSONField; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/common/Query.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/Query.java similarity index 80% rename from apidoc-springmvc/src/test/java/com/apigcc/example/common/Query.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/Query.java index 92ae713..fe8ab31 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/common/Query.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/Query.java @@ -1,4 +1,4 @@ -package com.apigcc.example.common; +package com.kim.apidoc.example.common; import lombok.Getter; import lombok.Setter; diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/common/ResultData.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/ResultData.java similarity index 87% rename from apidoc-springmvc/src/test/java/com/apigcc/example/common/ResultData.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/ResultData.java index f7ee978..b3f033f 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/common/ResultData.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/ResultData.java @@ -1,4 +1,4 @@ -package com.apigcc.example.common; +package com.kim.apidoc.example.common; import lombok.Getter; import lombok.Setter; diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/common/Role.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/Role.java similarity index 76% rename from apidoc-springmvc/src/test/java/com/apigcc/example/common/Role.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/Role.java index 6ef902b..25bdd5c 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/common/Role.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/Role.java @@ -1,4 +1,4 @@ -package com.apigcc.example.common; +package com.kim.apidoc.example.common; /** * 用户角色 diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/common/StaticFinalCode.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/StaticFinalCode.java similarity index 77% rename from apidoc-springmvc/src/test/java/com/apigcc/example/common/StaticFinalCode.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/StaticFinalCode.java index 3cef9c5..38c34d4 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/common/StaticFinalCode.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/StaticFinalCode.java @@ -1,4 +1,4 @@ -package com.apigcc.example.common; +package com.kim.apidoc.example.common; /** * @code diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/common/User.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/User.java similarity index 87% rename from apidoc-springmvc/src/test/java/com/apigcc/example/common/User.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/User.java index dfaf63a..97b50a3 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/common/User.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/User.java @@ -1,4 +1,4 @@ -package com.apigcc.example.common; +package com.kim.apidoc.example.common; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Getter; diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/common/UserDTO.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/UserDTO.java similarity index 89% rename from apidoc-springmvc/src/test/java/com/apigcc/example/common/UserDTO.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/UserDTO.java index dcd96a2..cf56289 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/common/UserDTO.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/UserDTO.java @@ -1,4 +1,4 @@ -package com.apigcc.example.common; +package com.kim.apidoc.example.common; import lombok.Getter; import lombok.Setter; diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/common/UserDetails.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/UserDetails.java similarity index 78% rename from apidoc-springmvc/src/test/java/com/apigcc/example/common/UserDetails.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/UserDetails.java index c37c65f..fdc15d3 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/common/UserDetails.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/UserDetails.java @@ -1,4 +1,4 @@ -package com.apigcc.example.common; +package com.kim.apidoc.example.common; /** * 某些用户信息框架,如spring security的用户登录信息 diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/common/UserQuery.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/UserQuery.java similarity index 75% rename from apidoc-springmvc/src/test/java/com/apigcc/example/common/UserQuery.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/UserQuery.java index baf4e7b..401ad9d 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/common/UserQuery.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/UserQuery.java @@ -1,4 +1,4 @@ -package com.apigcc.example.common; +package com.kim.apidoc.example.common; import lombok.Getter; import lombok.Setter; diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/common/Wrapper.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/Wrapper.java similarity index 70% rename from apidoc-springmvc/src/test/java/com/apigcc/example/common/Wrapper.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/Wrapper.java index 4f74b94..f612740 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/common/Wrapper.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/Wrapper.java @@ -1,4 +1,4 @@ -package com.apigcc.example.common; +package com.kim.apidoc.example.common; import lombok.Getter; import lombok.Setter; diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/spring/BaseController.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/BaseController.java similarity index 79% rename from apidoc-springmvc/src/test/java/com/apigcc/example/spring/BaseController.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/BaseController.java index 3f52b1c..d32ddfd 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/spring/BaseController.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/BaseController.java @@ -1,4 +1,4 @@ -package com.apigcc.example.spring; +package com.kim.apidoc.example.spring; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/spring/advanced/AuthController.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/advanced/AuthController.java similarity index 70% rename from apidoc-springmvc/src/test/java/com/apigcc/example/spring/advanced/AuthController.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/advanced/AuthController.java index b30d526..4c7e733 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/spring/advanced/AuthController.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/advanced/AuthController.java @@ -1,7 +1,7 @@ -package com.apigcc.example.spring.advanced; +package com.kim.apidoc.example.spring.advanced; -import com.apigcc.example.common.ResultData; -import com.apigcc.example.spring.BaseController; +import com.kim.apidoc.example.common.ResultData; +import com.kim.apidoc.example.spring.BaseController; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/spring/advanced/EmptyController.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/advanced/EmptyController.java similarity index 78% rename from apidoc-springmvc/src/test/java/com/apigcc/example/spring/advanced/EmptyController.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/advanced/EmptyController.java index 4b84a0b..d99b49d 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/spring/advanced/EmptyController.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/advanced/EmptyController.java @@ -1,4 +1,4 @@ -package com.apigcc.example.spring.advanced; +package com.kim.apidoc.example.spring.advanced; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/spring/advanced/IgnoreController.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/advanced/IgnoreController.java similarity index 81% rename from apidoc-springmvc/src/test/java/com/apigcc/example/spring/advanced/IgnoreController.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/advanced/IgnoreController.java index f2e611f..2ff3b75 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/spring/advanced/IgnoreController.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/advanced/IgnoreController.java @@ -1,4 +1,4 @@ -package com.apigcc.example.spring.advanced; +package com.kim.apidoc.example.spring.advanced; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/spring/advanced/KimUserController.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/advanced/KimUserController.java similarity index 82% rename from apidoc-springmvc/src/test/java/com/apigcc/example/spring/advanced/KimUserController.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/advanced/KimUserController.java index bfba702..dd1ab59 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/spring/advanced/KimUserController.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/advanced/KimUserController.java @@ -1,8 +1,8 @@ -package com.apigcc.example.spring.advanced; +package com.kim.apidoc.example.spring.advanced; -import com.apigcc.example.annotation.KimController; -import com.apigcc.example.common.ResultData; -import com.apigcc.example.common.User; +import com.kim.apidoc.example.annotation.KimController; +import com.kim.apidoc.example.common.ResultData; +import com.kim.apidoc.example.common.User; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/spring/advanced/PageController.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/advanced/PageController.java similarity index 89% rename from apidoc-springmvc/src/test/java/com/apigcc/example/spring/advanced/PageController.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/advanced/PageController.java index 7b8b436..e77340c 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/spring/advanced/PageController.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/advanced/PageController.java @@ -1,10 +1,10 @@ -package com.apigcc.example.spring.advanced; +package com.kim.apidoc.example.spring.advanced; -import com.apigcc.example.common.*; -import com.apigcc.example.spring.BaseController; -import com.apigcc.example.spring.hello.Greeting; import com.apigcc.model.Info; import com.apigcc.model.InfoQuery; +import com.kim.apidoc.example.common.*; +import com.kim.apidoc.example.spring.BaseController; +import com.kim.apidoc.example.spring.hello.Greeting; import org.jruby.ir.Tuple; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/spring/advanced/UserController.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/advanced/UserController.java similarity index 92% rename from apidoc-springmvc/src/test/java/com/apigcc/example/spring/advanced/UserController.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/advanced/UserController.java index 897f44b..b8746a2 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/spring/advanced/UserController.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/advanced/UserController.java @@ -1,7 +1,7 @@ -package com.apigcc.example.spring.advanced; +package com.kim.apidoc.example.spring.advanced; -import com.apigcc.example.common.*; -import com.apigcc.example.spring.BaseController; +import com.kim.apidoc.example.common.*; +import com.kim.apidoc.example.spring.BaseController; import org.springframework.http.ResponseEntity; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/spring/hello/Greeting.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/hello/Greeting.java similarity index 84% rename from apidoc-springmvc/src/test/java/com/apigcc/example/spring/hello/Greeting.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/hello/Greeting.java index 2fda48e..e0412f9 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/spring/hello/Greeting.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/hello/Greeting.java @@ -1,4 +1,4 @@ -package com.apigcc.example.spring.hello; +package com.kim.apidoc.example.spring.hello; public class Greeting { diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/spring/hello/GreetingController.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/hello/GreetingController.java similarity index 94% rename from apidoc-springmvc/src/test/java/com/apigcc/example/spring/hello/GreetingController.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/hello/GreetingController.java index c61c008..9a74535 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/spring/hello/GreetingController.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/hello/GreetingController.java @@ -1,4 +1,4 @@ -package com.apigcc.example.spring.hello; +package com.kim.apidoc.example.spring.hello; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; diff --git a/apidoc-springmvc/src/test/java/com/apigcc/springmvc/SpringTest.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/springmvc/SpringTest.java similarity index 86% rename from apidoc-springmvc/src/test/java/com/apigcc/springmvc/SpringTest.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/springmvc/SpringTest.java index c7a9288..f372c1d 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/springmvc/SpringTest.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/springmvc/SpringTest.java @@ -1,8 +1,8 @@ -package com.apigcc.springmvc; +package com.kim.apidoc.springmvc; -import com.apidoc.core.ApiDoc; -import com.apidoc.core.Context; -import com.apidoc.core.common.diff.FileMatcher; +import kim.apidoc.core.ApiDoc; +import kim.apidoc.core.Context; +import kim.apidoc.core.common.diff.FileMatcher; import org.junit.Test; import java.io.IOException; @@ -17,7 +17,7 @@ public class SpringTest { Context context = new Context(); context.setId("test"); context.setName("测试项目"); - context.addSource(Paths.get("K:\\@project-dianli@\\apigcc\\apigcc-springmvc\\src\\test\\java")); + context.addSource(Paths.get("K:\\@project-dianli@\\tool\\apidoc\\apidoc-springmvc\\src\\test\\java")); // context.setCss("https://darshandsoni.com/asciidoctor-skins/css/monospace.css"); ApiDoc apigcc = new ApiDoc(context); @@ -47,7 +47,7 @@ public class SpringTest { FileMatcher fileMatcher = new FileMatcher(); int changed = fileMatcher.compare(template, buildAdoc); if(changed>0){ - fileMatcher.rederHtml(templateHtml, resultHtml); + fileMatcher.renderHtml(templateHtml, resultHtml); } System.out.println("BUILD SUCCESS"); @@ -76,7 +76,7 @@ public class SpringTest { FileMatcher fileMatcher = new FileMatcher(); int changed = fileMatcher.compare(template, buildAdoc); if(changed>0){ - fileMatcher.rederHtml(templateHtml, resultHtml); + fileMatcher.renderHtml(templateHtml, resultHtml); } System.out.println("BUILD SUCCESS"); diff --git "a/markdown\346\216\245\345\217\243\346\250\241\347\211\210.md" "b/markdown\346\216\245\345\217\243\346\250\241\347\211\210.md" index ead46e3..a596775 100644 --- "a/markdown\346\216\245\345\217\243\346\250\241\347\211\210.md" +++ "b/markdown\346\216\245\345\217\243\346\250\241\347\211\210.md" @@ -56,9 +56,9 @@ POST /api/v1/users HTTP/1.1 } ``` -| Field | Type | Condition | Default | Description | -| :------- | :----- | :-------- | :------ | :---------- | -| loginId | String | | | 用户编号 | -| userName | String | | | 用户名 | -| password | String | | | 密码 | +| Field | Type | Description | +| :------- | :----- | :---------- | +| loginId | String | 用户编号 | +| userName | String | 用户名 | +| password | String | 密码 | -- GitLab