Skip to content

xdpsee/vertx-codegen-lombok

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 

Repository files navigation

vertx-codegen lombok 共用

  1. 添加lombok依赖
<dependency>
    <groupId>org.projectlombok</groupId>
    <artifactId>lombok</artifactId>
    <version>1.18.6</version>
    <scope>provided</scope>
</dependency>
  1. maven-compiler-plugin 配置
<build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <annotationProcessors>
                        <!-- lombok在前, 否则会出错 -->

                      <annotationProcessor>lombok.launch.AnnotationProcessorHider$AnnotationProcessor,io.vertx.codegen.CodeGenProcessor</annotationProcessor>
                    </annotationProcessors>
                    <generatedSourcesDirectory>${project.build.directory}/generated-sources/annotations</generatedSourcesDirectory>
                </configuration>
            </plugin>
        </plugins>
    </build>
  1. 示例
@Data
@NoArgsConstructor
@DataObject(generateConverter = true)
public class CellTower implements Serializable {

    private static final long serialVersionUID = 1758268454928348674L;

    private String radioType;

    private Long cellId;

    private Integer locationAreaCode;

    private Integer mobileCountryCode;

    private Integer mobileNetworkCode;

    private Integer signalStrength;

    public CellTower(JsonObject jsonObj) {
        CellTowerConverter.fromJson(jsonObj, this);
    }

    public JsonObject toJson() {
        JsonObject jsonObj = new JsonObject();
        CellTowerConverter.toJson(this, jsonObj);
        return jsonObj;
    }
}
  1. enjoy it!

About

vertx-codegen-lombok vertx codegen lombok

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published