JDK|1.Lombok
小于 1 分钟
描述
说明
添加依赖
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>{{ LOMBOK_VERSION }}</version>
<scope>provided</scope>
</dependency>
不使用Lombok
package com.gameserver.exorcistserver.controller;
import java.math.BigInteger;
public class UmsAdminController {
private BigInteger id;
private String name;
public BigInteger getId() {
return id;
}
public void setId(BigInteger id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
return "UmsAdminController{" +
"id=" + id +
", name='" + name + '\'' +
'}';
}
@Override
public int hashCode() {
return Objects.hash(id, username);
}
}
使用Lombok
package com.gameserver.exorcistserver.controller;
import lombok.Data;
import java.math.BigInteger;
@Data
public class UmsAdminController {
private BigInteger id;
private String name;
}