使用Lombok消除冗长的Java 代码
Lombok通过简单的注解的形式,可以为我们的POJO对象属性生成Getter、Setter、ToStirng()和构造函数等代码。
Lombok的注解主要有:
@Data
All together now: A shortcut for @ToString, @EqualsAndHashCode, @Getter on all fields, and @Setter on all non-final fields, and @RequiredArgsConstructor!
@Getter / @Setter
Never write public int getFoo() {return foo;} again.
@ToString No need to start a debugger to see your fields: Just let lombok generate a toString for you!