In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces "how to solve the failure of Idea installation lombok plug-in". In daily operation, I believe many people have doubts about how to solve the failure of Idea installation lombok plug-in. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubt of "how to solve the failure of Idea installation lombok plug-in". Next, please follow the editor to study!
A brief introduction to lombok
Lombok provides the use of annotations to help simplify the elimination of java code. When writing Java code, you can simplify development by using corresponding annotations, and at the same time, lombok automatically generates the corresponding code when compiling the source code. Therefore, using the lombok plug-in will not affect the efficiency of the program.
2. Common notes on lombok
Data: annotated on the class; includes the functions of @ ToString,@EqualsAndHashCode,@Getter / @ Setter and @ RequiredArgsConstructor, providing getter and setter methods for all properties of the class, as well as equals, canEqual, hashCode, toString methods.
Setter: annotate the property; provide the setter method for the property.
Getter: annotate the property; provide the getter method for the property.
The default generated method is public. If you want to modify the method modifier, you can set the value of AccessLevel, for example: @ Getter (access = AccessLevel.PROTECTED).
ToString: annotate the class; generate the toString () method, which by default prints your class name and each field in order (separated by commas). You can set which fields @ ToString (exclude = "id") / @ ToString (exclude = {"id", "name"}) are not included.
If you inherit a parent class, you can set callSuper to call the parent class's toString () method, for example: @ ToString (callSuper = true).
EqualsAndHashCode: annotate the class; generate the hashCode () and equals () methods, which by default will use all non-static, non-transient fields. However, you can exclude more fields by including the optional exclude parameter. Alternatively, specify exactly which fields you want to use by naming them in the parameter parameter.
@ NonNull: comment on the attribute; identify that the property cannot be empty, or throw an exception if it is empty.
Slf4j: annotate the class; generate log log objects based on the logging framework actually used by the user.
@ Log4j: annotate the class; provide a log4j log object with the property name log for the class
NoArgsConstructor: annotate the class; provide a no-parameter constructor for the class. When a final field in the class is not initialized, the compiler reports an error, using @ NoArgsConstructor (force = true), and then sets the default value of 0 / false / null for the uninitialized final field. For fields with constraints, such as the @ NonNull field, no checks or assignments are generated, so note that these constraints are not valid until these fields are initialized correctly.
AllArgsConstructor: annotate the class; provide an all-parameter constructor for the class.
@ RequiredArgsConstructor: annotated on the class; a constructor is generated (with or without parameters). With parameters, this parameter can only be an uninitialized field decorated with final, or the uninitialized field @ RequiredArgsConstructor annotated with @ NonNull (staticName = "of") generates a static method of of () and sets the constructor private.
II. Install and configure lombok
1. Introduce dependency package
(1) maven introduces dependency:
Org.projectlombok lombok
(2) gradle introduces dependency:
Compile group: 'org.projectlombok', name:' lombok', version: '1.16.18'
(3) put lombok.jar directly under the source folder.
2. Install the plug-in
(1) press Alt+Ctrl+S to open the Settings dialog box and install the lombok plug-in.
3. Set Enable annotation processing
After upgrading to the latest version 2019.2, idea does not have to solve the incompatibility problem as many people say on the Internet, but can be used normally as configured above.
At this point, the study on "how to solve the failure of Idea installation lombok plug-in" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.