Skip to content

IntelliJ IDEA / Android studio Plugin. Easily generate Swagger and Protostuff annotations with one click, generate JavaDoc with various data sources. deleting various elements can also be done with one click.

License

Notifications You must be signed in to change notification settings

bitkylin/bitkylin-universal-generate

Repository files navigation

Bitkylin Universal Generate

Build Version Downloads

Easily generate Swagger and Protostuff annotations with one click, generate JavaDoc with various data sources. deleting various elements can also be done with one click.

What's this?

  • Jetbrains IntelliJ IDEA / Android studio Plugin.
  • For Controller class or POJO class, you can easily generate Protostuff annotations ' @Tag ' with one click and convert JavaDoc to Swagger annotations ' @Api, @ApiOperation, @ApiModel, @ApiModelProperty ' with one click. In turn, you can convert Swagger annotations to JavaDoc with a single click.
  • You can generate a JavaDoc for the specified field , please note that this is not generated by 'translation' , but fuzzy matching the project with the same name field , matching its comments and Swagger annotations , extracted and populated with JavaDoc for the specified field.

做什么呢?

Features

  1. You can generate Swagger annotations ' @Api, @ApiOperation, @ApiModel, @ApiModelProperty ' with one click, and Protostuff annotations ' @Tag ' with one click via the right-click menu.
  2. you can through the right-click menu , one-click Swagger annotations converted to JavaDoc annotations.
  3. With the cursor pointing to the name of a class, field or method, right-clicking Execute allows you to process only that element. When the cursor is pointing elsewhere, right-click to perform unified processing for all elements in the current file.
  4. You can remove the JavaDoc, annotations, etc. of a class, field, or method with a single click via the right-click menu.
  5. If you only need to work with the Swagger annotation and not the Protostuff annotation and vice versa, don't worry, you can switch between them via the 'settings - tools - Bitkylin Universal Generate' page. Of course, you can also disable the operation of both annotations and only operate JavaDoc.
  6. You declared the class fields, or declared the method parameter fields, but you do not want to manually write JavaDoc, you can right-click the menu, use the 'Find JavaDoc' feature, the feature can be based on the same name field in the project, exact or fuzzy match its comments and Swagger annotations, to generate the specified fields of the JavaDoc.
  7. The plugin supports two languages, English and Chinese, which can be switched via the 'settings - tools - Bitkylin Universal Generate' page.

特性

  1. 你可以通过右键菜单,一键生成Swagger注解 ' @Api, @ApiOperation, @ApiModel, @ApiModelProperty ', 一键生成Protostuff注解 ' @Tag '。
  2. 你可以通过右键菜单,一键将 Swagger 注解转换为 JavaDoc 注释。
  3. 光标指向类、字段或者方法的名字,点击右键执行,可以仅针对该元素进行处理。当光标指向其他地方,点击右键,可以对当前文件中的所有元素进行统一处理。
  4. 你可以通过右键菜单,一键删除类、字段或者方法的 JavaDoc、注解等。
  5. 如果你只需要操作 Swagger 注解而不需要操作 Protostuff 注解,反之亦然,不用担心,你可以通过 'settings - tools - Bitkylin Universal Generate' 页面进行切换。当然了,你也可以关闭两个注解的操作功能,仅操作JavaDoc。
  6. 你声明了类的字段,或者声明了方法的入参字段,但是你不想手动编写JavaDoc,你可以通过右键菜单,使用'查找JavaDoc'功能,该功能可以根据项目中的同名字段,精确或模糊匹配其注释及Swagger注解,生成指定字段的JavaDoc。
  7. 插件支持两种语言,英文和中文,可以通过 'settings - tools - Bitkylin Universal Generate' 页面进行切换。

Tip.

NO.1

Class name suffixed with ' Controller ', or with ' @Controller, @RestController ' annotation, you will add ' @Api, @ApiOperation ' annotation when you execute the instruction. Classes with Lombok annotations ' @Data, @Getter, @Setter ' will add ' @ApiModel, @ApiModelProperty, @Tag ' annotation when you execute the instruction.

类名后缀为 ' Controller ',或者有 ' @Controller、@RestController ' 注解,你在执行指令时,会添加 ' @Api, @ApiOperation ' 注解。类上有Lombok注解 ' @Data、@Getter、@Setter ',你在执行指令时,会添加 ' @ApiModel, @ApiModelProperty, @Tag ' 注解。

NO.2

If you want to generate @Tag annotations for the whole document with a customized starting number, just set the starting number in the first field of the class and execute 'Generate Entry Annotation - Full Document' via the right-click menu, See the next section: Class Format Examples.

如果你想按照自定义的起始序号,生成整个文档的 @Tag 注解,只需要在类中的第一个字段设置起始序号即可,然后通过右键菜单执行'生成入口注解 - 整个文档' ,参见下一节:类格式示例。

NO.3

@Data
public class TestRequest {
    private String name;
}

Above is your declared class and a field, but you don't want to manually write the field's JavaDoc, you can use the 'Search JavaDoc' function via the right-click menu, which can generate the JavaDoc for the specified field based on the same field in the project, matching its comments and Swagger annotations exactly or fuzzy.

上面是你声明的类以及一个属性,但是你不想手动编写属性的JavaDoc,你可以通过右键菜单,使用'查找JavaDoc'功能,该功能可以根据项目中的同名字段,精确或模糊匹配其注释及Swagger注解,生成指定字段的JavaDoc。

Class Format Examples

POJO

import io.protostuff.Tag;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;

@Data
public class TestRequest {
    @Tag(105)
    private String name;
    /**
     * bitkylin age
     */
    private Integer age;
    private Address address;

    @Setter
    @Getter
    public static class Address {
        @Tag(208)
        private String province;
        private String city;
        private String detailedAddress;
    }
}

controller

/**
 * test desc
 *
 * @author bitkylin
 */
@RestController
@RequestMapping('/test')
public class TestController {
    /**
     * test api one
     */
    @PostMapping('/api-one')
    public String apiOne(@RequestBody TestRequest request) {
        return 'success';
    }
}

感谢

感谢以下项目提供的灵感与实现方式:

Installation

  • Using the IDE built-in plugin system:

    Settings/Preferences > Plugins > Marketplace > Search for "Bitkylin Universal Generate" > Install

  • Manually:

    Download the latest release and install it manually using Settings/Preferences > Plugins > ⚙️ > Install plugin from disk...

Template ToDo list


Plugin based on the IntelliJ Platform Plugin Template.

About

IntelliJ IDEA / Android studio Plugin. Easily generate Swagger and Protostuff annotations with one click, generate JavaDoc with various data sources. deleting various elements can also be done with one click.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published