Lombok常用注解

一、常用注解

@NonNull : 注解在参数上, 如果该类参数为 null , 就会报出异常, throw new NullPointException(参数名)

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

@Getter/@Setter : 注解在类上, 为类提供读写属性

@Getter(lazy=true) :

@ToString : 注解在类上, 为类提供 toString() 方法

@EqualsAndHashCode : 注解在类上, 为类提供 equals() 和 hashCode() 方法

@NoArgsConstructor, @RequiredArgsConstructor, @AllArgsConstructor : 注解在类上, 为类提供无参,有指定必须参数, 全参构造函数

参考资料:

Lombok常用注解

原文地址:https://www.cnblogs.com/wangwangfei/p/13469022.html