当前位置:网站首页>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
边栏推荐
- FastDateFormat为什么线程安全
- Input a three digit number and output its single digit, ten digit and hundred digit.
- Seriation in R: How to Optimally Order Objects in a Data Matrice
- Natural language processing series (II) -- building character level language model using RNN
- 二分刷题记录(洛谷题单)区间的甄别
- Filtre de profondeur de la série svo2
- 子线程获取Request
- 堆(優先級隊列)
- Lekao: contents of the provisions on the responsibility of units for fire safety in the fire protection law
- 刷题---二叉树--2
猜你喜欢
随机推荐
(C语言)输入一行字符,分别统计出其中英文字母、空格、数字和其它字符的个数。
Le tutoriel F - String le plus facile à comprendre de l'histoire.
Data analysis - Matplotlib sample code
Leetcode739 每日温度
Jenkins voucher management
SSH automatically disconnects (pretends to be dead) after a period of no operation
Natural language processing series (III) -- LSTM
Read the Flink source code and join Alibaba cloud Flink group..
QT meter custom control
Log4j2
Leetcode922 按奇偶排序数组 II
5g era, learning audio and video development, a super hot audio and video advanced development and learning classic
自然语言处理系列(三)——LSTM
求16以内正整数的阶乘,也就是n的阶层(0=<n<=16)。输入1111退出。
Jenkins用户权限管理
高德地图测试用例
ORB-SLAM2不同线程间的数据共享与传递
HOW TO CREATE AN INTERACTIVE CORRELATION MATRIX HEATMAP IN R
Fabric. JS 3 APIs to set canvas width and height
Log4j2









