随笔记录-分享&记忆

读书之法,----------------在循序而渐进,-----------熟读而精思 --------朱熹

lombok最全的,最新的学习资料,demo【最全的注解】打开蓝色注解链接

面试的时候,有问起这个lombok是什么玩意儿? 当时没有使用过,感觉挺好奇的,简单研究了下

打开下方蓝色注解链接-有惊喜

lombok官方地址: https://projectlombok.org/download.html


使用Maven来添加支持

<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
<dependency>
    <groupId>org.projectlombok</groupId>
    <artifactId>lombok</artifactId>
    <version>1.16.10</version>
</dependency>

使用idea插件,需要安装,设置下。















下面贴一些官网的demo:

val
Finally! Hassle-free final local variables.
@NonNull
or: How I learned to stop worrying and love the NullPointerException.
@Cleanup
Automatic resource management: Call your close() methods safely with no hassle.
@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 atoString for you!
@EqualsAndHashCode
Equality made easy: Generates hashCode andequals implementations from the fields of your object.
@NoArgsConstructor,@RequiredArgsConstructor and@AllArgsConstructor
Constructors made to order: Generates constructors that take no arguments, one argument per final / non-null field, or one argument for every field.
@Data
All together now: A shortcut for @ToString,@EqualsAndHashCode,@Getter on all fields, and@Setter on all non-final fields, and@RequiredArgsConstructor!
@Value
Immutable classes made very easy.
@Builder
... and Bob's your uncle: No-hassle fancy-pants APIs for object creation!
@SneakyThrows
To boldly throw checked exceptions where no one has thrown them before!
@Synchronized
synchronized done right: Don't expose your locks.
@Getter(lazy=true)
Laziness is a virtue!
@Log
Captain's Log, stardate 24435.7: "What was that line again?"
Configuration system
Lombok, made to order: Configure lombok features in one place for your entire project or even your workspace.
Experimental features
Here be dragons: Extra features which aren't quite ready for prime time yet.



阅读更多
版权声明:本文为博主原创文章,可以转载分享,希望大家相互学习,共同进步 https://blog.csdn.net/shenhonglei1234/article/details/53507867
文章标签: lombok
个人分类: lombok DB
上一篇There is no getter for property named 'email' in 'class java.lang.String
下一篇Spring MVC配置静态资源,直接映射到对应的文件夹,DispatcherServlet 不处理
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭