同步操作将从 叶大侠/JApiDocs 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
Click hear to check the example.
JApiDocs is a Java programming tool that complies with the Java programming conventions. JApiDocs will help you to export a beautiful Html document and generate relevant Java and Object-C related data model code, this will reduce Android And IOS Client Developers's work, and you do not need to work hard to maintain changes in the api documents, just need to maintain your code.
In spring, for example, the image below will help you easilly to understand how JApidocs works.
As you can see, you can done your work so naturally. the only extra part is the @ApiDoc
, we will discuss this below.
@ApiDoc
is a custom annatation, as we known, unless we run the program , otherwise we can not know what the response really contains. To solve this problem, we bring into View Class
, we can know what will return in the response by the View Class
, and JApiDocs
will read every member of it and its parent class except the static
member. this is why @ApiDoc
exists.
you can just simplly include our jar
or create a class naming ApiDoc
in your project, it doesn't care where package it belongs.
@Retention(RetentionPolicy.SOURCE)
@Target({ElementType.METHOD})
public @interface ApiDoc {
/**
* result class
* @return
*/
Class<?> value() default Null.class;
/**
* result class
*/
Class<?> result() default Null.class;
/**
* request url
*/
String url() default "";
/**
* request method
*/
String method() default "get";
final class Null{
}
}
(1) add dependencies below:
compile 'io.github.yedaxia:japidocs:1.2.4'
(2) one line simple java code:
Docs.buildHtmlDocs(DocsConfig config);
config attributes:
projectPath: project directory Windows users should use double slash '\\' or backslash '/'
docsPath: Document output directory (not required, default is ${projectPath}/apidocs)
codeTplPath: Code template directory (not required, if you need custom generated code will be used.)
mvcFramework:[spring, play, jfinal, generic] (not required, the code has internal judgment, if there is a misjudgment, you can use this to force the specified)
javaSrcPaths: (not required) Multi-module projects currently support maven and gradle. If not resolved, the source directory can be added via the `addJavaSrcPath` method.
Plugins: (not required) custom implementation plugin
copy the template files in the project, and make the template you like:
class UserVO{
BookVO book;
}
class BookKVO{
UserVO user;
}
configRoute
:@Override
public void configRoute(Routes me) {
me.add("/api/v1/user", UserController.class);
me.add("/api/v1/book", BookController.class);
me.add(new AmdinRoutes());
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。