当前位置:网站首页>Lombok common annotations
Lombok common annotations
2022-07-02 12:09:00 【A cat wandering in the middle of the night】
Chapter one lombok Commonly used annotations
List of articles
Link to the original text https://zhhll.icu/2021/ Third party tools /lombok/1.lombok Commonly used annotations /
lombok Commonly used annotations
lombok rely on
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.18</version>
<scope>provided</scope>
</dependency>
lombok annotation
- @Getter/@Setter: On the action class , Generate... For all member variables getter/setter Method ; Act on member variables , The getter/setter Method
- @ToString: Act on a class , Override the default toString() Method , Can pass of Properties restrict the display of certain fields , adopt exclude Properties exclude certain fields
- @EqualsAndHashCode: Act on a class , Override the default equals and hashCode
- @NonNull: It is mainly used in member variables and parameters , Logo cannot be empty , Otherwise, a null pointer exception is thrown
- @NoArgsConstructor, @RequiredArgsConstructor, @AllArgsConstructor: Act on a class , Used to generate constructors . Yes staticName、access Equal attribute ,staticName Once the property is set , The instance will be generated in a static way ,access Property to restrict access [email protected] Generate parameterless constructors ;@RequiredArgsConstructor Generation contains final and @NonNull Constructor of member variable of annotation ;@AllArgsConstructor Generate full parameter constructors
- @Data: Act on a class , Is a collection of the following annotations :@ToString @EqualsAndHashCode @Getter @Setter @RequiredArgsConstructor
- @Builder: Act on a class , Turn classes into builder mode
- @Log: Act on a class , Generate log variables . Implement products for different logs , There are different notes , Such as @Slf4j、@Log4j2 etc.
- @Cleanup: Close resources automatically , For the realization of java.io.Closeable The object of the interface is valid , Such as : Typical IO Stream object
- @SneakyThrows: You can catch the detected exception and throw
- @Synchronized: Act on method level , Can replace synchronize Keywords or lock lock
边栏推荐
- b格高且好看的代码片段分享图片生成
- Dynamic memory (advanced 4)
- Data analysis - Matplotlib sample code
- 测试左移和右移
- drools决策表的简单使用
- (C language) 3 small Codes: 1+2+3+ · · +100=? And judge whether a year is a leap year or a normal year? And calculate the circumference and area of the circle?
- Uniapp uni list item @click, uniapp uni list item jump with parameters
- Flesh-dect (media 2021) -- a viewpoint of material decomposition
- Lekao: contents of the provisions on the responsibility of units for fire safety in the fire protection law
- How to Easily Create Barplots with Error Bars in R
猜你喜欢
5g era, learning audio and video development, a super hot audio and video advanced development and learning classic
基于Arduino和ESP8266的Blink代码运行成功(包含错误分析)
[QT] Qt development environment installation (QT version 5.14.2 | QT download | QT installation)
Jenkins user rights management
mysql数据库基础
Lekao: contents of the provisions on the responsibility of units for fire safety in the fire protection law
Mish shake the new successor of the deep learning relu activation function
SVO2系列之深度濾波DepthFilter
Read the Flink source code and join Alibaba cloud Flink group..
Larvel modify table fields
随机推荐
The blink code based on Arduino and esp8266 runs successfully (including error analysis)
【2022 ACTF-wp】
drools执行String规则或执行某个规则文件
Natural language processing series (III) -- LSTM
SVO2系列之深度滤波DepthFilter
Le tutoriel F - String le plus facile à comprendre de l'histoire.
CMake交叉编译
JZ63 股票的最大利润
GGPUBR: HOW TO ADD ADJUSTED P-VALUES TO A MULTI-PANEL GGPLOT
PyTorch nn. Full analysis of RNN parameters
【C语言】十进制数转换成二进制数
Data analysis - Matplotlib sample code
Map和Set
[geek challenge 2019] upload
YYGH-BUG-05
(C language) octal conversion decimal
YYGH-BUG-05
CONDA common command summary
史上最易懂的f-string教程,收藏这一篇就够了
Mish-撼动深度学习ReLU激活函数的新继任者