当前位置:网站首页>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
边栏推荐
- SVO2系列之深度滤波DepthFilter
- YYGH-10-微信支付
- Take you ten days to easily finish the finale of go micro services (distributed transactions)
- Log4j2
- Time format display
- 深入理解PyTorch中的nn.Embedding
- Leetcode122 买卖股票的最佳时机 II
- Fresh, 2022 advanced Android interview must know 100 questions (interview questions + answer analysis)
- Log4j2
- Orb-slam2 data sharing and transmission between different threads
猜你喜欢

Mish-撼动深度学习ReLU激活函数的新继任者

Mish shake the new successor of the deep learning relu activation function

GGPLOT: HOW TO DISPLAY THE LAST VALUE OF EACH LINE AS LABEL

CDA数据分析——AARRR增长模型的介绍、使用

Dynamic memory (advanced 4)

YYGH-9-预约下单
![[C language] convert decimal numbers to binary numbers](/img/9b/1848b68b95d98389ed985c83f2e856.png)
[C language] convert decimal numbers to binary numbers

ThreadLocal的简单理解

Thesis translation: 2022_ PACDNN: A phase-aware composite deep neural network for speech enhancement

堆(优先级队列)
随机推荐
Larvel modify table fields
记录一下MySql update会锁定哪些范围的数据
Fabric. JS 3 APIs to set canvas width and height
时间格式化显示
Leetcode209 subarray with the smallest length
QT meter custom control
还不会安装WSL 2?看这一篇文章就够了
B high and beautiful code snippet sharing image generation
How to Visualize Missing Data in R using a Heatmap
[C language] convert decimal numbers to binary numbers
Flesh-dect (media 2021) -- a viewpoint of material decomposition
CDA数据分析——Excel数据处理的常见知识点归纳
基于Arduino和ESP8266的连接手机热点实验(成功)
H5,为页面添加遮罩层,实现类似于点击右上角在浏览器中打开
Full link voltage measurement
Leetcode topic [array] -540- single element in an ordered array
ThreadLocal的简单理解
【工控老马】西门子PLC Siemens PLC TCP协议详解
ORB-SLAM2不同线程间的数据共享与传递
小程序链接生成