{"id":20676744,"url":"https://github.com/marklux/javajsondoclet","last_synced_at":"2026-03-19T17:02:51.963Z","repository":{"id":37130525,"uuid":"248400142","full_name":"MarkLux/JavaJsonDoclet","owner":"MarkLux","description":"a custom json format doclet for java code.","archived":false,"fork":false,"pushed_at":"2022-06-17T03:03:06.000Z","size":40,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-16T10:54:56.253Z","etag":null,"topics":["doclet","javadoc"],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MarkLux.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-19T03:16:50.000Z","updated_at":"2020-04-02T03:06:17.000Z","dependencies_parsed_at":"2022-09-04T02:12:27.957Z","dependency_job_id":null,"html_url":"https://github.com/MarkLux/JavaJsonDoclet","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/MarkLux/JavaJsonDoclet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarkLux%2FJavaJsonDoclet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarkLux%2FJavaJsonDoclet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarkLux%2FJavaJsonDoclet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarkLux%2FJavaJsonDoclet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MarkLux","download_url":"https://codeload.github.com/MarkLux/JavaJsonDoclet/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarkLux%2FJavaJsonDoclet/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270011169,"owners_count":24511896,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-12T02:00:09.011Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["doclet","javadoc"],"created_at":"2024-11-16T21:13:33.417Z","updated_at":"2026-02-10T16:16:30.910Z","avatar_url":"https://github.com/MarkLux.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Json Doclet\n\n\u003e 一个简洁的Java代码结构解析器\n\n## 使用说明\n\n基于[Doclet API](https://docs.oracle.com/javase/7/docs/technotes/guides/javadoc/doclet/overview.html)实现，可以扫描源码文件生成json格式的类及服务描述，可用于文档生成和代码提示等场景。\n\n使用时将需要解析的类用`@Model`注解，将需要解析的接口用`@Service`注解，注意填写`namespace`以实现命名隔离。\n\n解析时会自动递归所有已声明模型中引用的类及接口中引用的类。\n\n## 通过javadoc命令调用\n\n```\njavadoc -doclet com.marklux.doclet.JsonDoclet -sourcepath xxx -subpackages com.xxx -encoding UTF-8 -outputfile schema.json\n```\n\n## 通过maven插件集成(推荐)\n\n在指定的module中引入插件并配置参数：\n\n```xml\n\u003cbuild\u003e\n    \u003cplugins\u003e\n        \u003cplugin\u003e\n            \u003cgroupId\u003ecom.marklux\u003c/groupId\u003e\n            \u003cartifactId\u003ejson-doclet.plugin\u003c/artifactId\u003e\n            \u003cversion\u003e1.0\u003c/version\u003e\n            \u003cconfiguration\u003e\n                \u003csourcePath\u003edemo/src/main/java\u003c/sourcePath\u003e\n                \u003csubPackage\u003ecom.alibaba\u003c/subPackage\u003e\n                \u003cencoding\u003eUTF-8\u003c/encoding\u003e\n                \u003coutputpath\u003edemo/src/main/resources\u003c/outputpath\u003e\n            \u003c/configuration\u003e\n            \u003cexecutions\u003e\n                \u003cexecution\u003e\n                    \u003cid\u003epackage\u003c/id\u003e\n                    \u003cgoals\u003e\n                        \u003cgoal\u003epackage\u003c/goal\u003e\n                    \u003c/goals\u003e\n                    \u003cphase\u003epackage\u003c/phase\u003e\n                \u003c/execution\u003e\n            \u003c/executions\u003e\n        \u003c/plugin\u003e\n    \u003c/plugins\u003e\n    \u003c/build\u003e\n```\n\n配置说明\n\n- sourcePath 配置扫描源码的source path\n- subPackage 子包\n- encoding 源码的编码\n- outputpath 输出json文件的目录\n\n## JSON格式示范\n\n```json\n{\n  \"models\": [\n    {\n      \"containGenericType\": false,\n      \"description\": \"用户模型\",\n      \"hasParent\": true,\n      \"packageName\": \"com.marklux.doclet.demo\",\n      \"parentType\": \"java.lang.Object\",\n      \"properties\": [\n        {\n          \"collection\": false,\n          \"comment\": \"姓名\",\n          \"containGenericType\": false,\n          \"map\": false,\n          \"name\": \"name\",\n          \"primitive\": true,\n          \"type\": \"java.lang.String\"\n        },\n        {\n          \"collection\": false,\n          \"comment\": \"年龄\",\n          \"containGenericType\": false,\n          \"map\": false,\n          \"name\": \"age\",\n          \"primitive\": true,\n          \"type\": \"java.lang.Integer\"\n        },\n        {\n          \"collection\": false,\n          \"comment\": \"性别，male: 男；female: 女\",\n          \"containGenericType\": false,\n          \"map\": false,\n          \"name\": \"sex\",\n          \"primitive\": true,\n          \"type\": \"java.lang.String\"\n        },\n        {\n          \"collection\": false,\n          \"comment\": \"手机号码\",\n          \"containGenericType\": false,\n          \"map\": false,\n          \"name\": \"mobile\",\n          \"primitive\": true,\n          \"type\": \"java.lang.String\"\n        },\n        {\n          \"collection\": true,\n          \"comment\": \"图片列表\",\n          \"containGenericType\": true,\n          \"map\": false,\n          \"name\": \"photos\",\n          \"primitive\": false,\n          \"type\": \"java.util.List\",\n          \"valueType\": \"java.lang.String\"\n        }\n      ],\n      \"type\": \"com.marklux.doclet.demo.User\"\n    },\n    {\n      \"containGenericType\": false,\n      \"description\": \"通用数据包装\",\n      \"hasParent\": true,\n      \"packageName\": \"com.marklux.doclet.demo\",\n      \"parentType\": \"java.lang.Object\",\n      \"properties\": [\n        {\n          \"collection\": false,\n          \"comment\": \"数据\",\n          \"containGenericType\": false,\n          \"map\": false,\n          \"name\": \"data\",\n          \"primitive\": true,\n          \"type\": \"java.lang.Object\"\n        },\n        {\n          \"collection\": false,\n          \"comment\": \"是否成功\",\n          \"containGenericType\": false,\n          \"map\": false,\n          \"name\": \"success\",\n          \"primitive\": true,\n          \"type\": \"boolean\"\n        }\n      ],\n      \"type\": \"com.marklux.doclet.demo.DTO\"\n    }\n  ],\n  \"services\": [\n    {\n      \"alias\": \"helloService\",\n      \"description\": \"测试服务\",\n      \"methods\": [\n        {\n          \"comment\": \"说你好\",\n          \"methodName\": \"sayHello\",\n          \"params\": [\n            {\n              \"collection\": false,\n              \"containGenericType\": false,\n              \"map\": false,\n              \"name\": \"user\",\n              \"primitive\": false,\n              \"type\": \"com.marklux.doclet.demo.User\"\n            }\n          ],\n          \"paramsComment\": {\n            \"user\": \"用户模型\"\n          },\n          \"resultComment\": \"你好文本\",\n          \"resultType\": {\n            \"collection\": false,\n            \"containGenericType\": false,\n            \"map\": false,\n            \"primitive\": true,\n            \"type\": \"java.lang.String\"\n          }\n        },\n        {\n          \"comment\": \"打招呼\",\n          \"methodName\": \"greeting\",\n          \"params\": [\n            {\n              \"collection\": false,\n              \"containGenericType\": false,\n              \"map\": false,\n              \"name\": \"s\",\n              \"primitive\": true,\n              \"type\": \"java.lang.String\"\n            }\n          ],\n          \"paramsComment\": {\n            \"s\": \"名字\"\n          },\n          \"resultComment\": \"招呼文本\",\n          \"resultType\": {\n            \"collection\": false,\n            \"containGenericType\": false,\n            \"map\": false,\n            \"primitive\": false,\n            \"type\": \"com.marklux.doclet.demo.DTO\"\n          }\n        }\n      ],\n      \"serviceInterface\": \"com.marklux.doclet.demo.HelloService\",\n      \"tags\": []\n    }\n  ]\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarklux%2Fjavajsondoclet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarklux%2Fjavajsondoclet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarklux%2Fjavajsondoclet/lists"}