Lombok常用注解

 

一、常用注解

 

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

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

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

@Getter(lazy=true) :

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

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

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

 

 

参考资料:

Lombok常用注解

posted @ 2020-08-10 12:07  风过无痕521  阅读(182)  评论(0编辑  收藏  举报