Lombok注解指南

@Data :注解在类上;提供类所有属性的 getting 和 setting 方法,此外还提供了equals、canEqual、hashCode、toString 方法

@Setter:注解在属性上;为属性提供 setting 方法

@Getter:注解在属性上;为属性提供 getting 方法

@Log4j :注解在类上;为类提供一个 属性名为log 的 log4j 日志对象

@NoArgsConstructor:注解在类上;为类提供一个无参的构造方法

@AllArgsConstructor:注解在类上;为类提供一个全参的构造方法

@NonNull:注解在参数上 如果该参数为null 会throw new NullPointerException(参数名);

@Cleanup:注释在引用变量前:自动回收资源 默认调用close方法

  @Cleanup("dispose") org.eclipse.swt.widgets.CoolBar bar = new CoolBar(parent, 0);

  @Cleanup InputStream in = new FileInputStream(args[0]);

  @Cleanup OutputStream out = new FileOutputStream(args[1]);

@Builder:注解在类上;为类提供一个内部的Builder

 

官网:

https://projectlombok.org/

英文原版:

https://projectlombok.org/features/index.html

原文地址:https://www.cnblogs.com/guihuo/p/5657025.html