About lombok use

In order to improve the development efficiency and simplify the complexity of the code, thereby reducing lombok may be introduced manually created entity class constructor, setter, getter, toString encoding the like.

  • eclipse introduced lombok.

First eclispe itself need to download lombok plugins:

1. Download plugin address: https: //projectlombok.org/download

2. downloaded to the local packet lombok.jar eclipse.ini file copied to the same directory, and opens eclipse.ini add the following configuration:

1 -Xbootclasspath/a:lombok.jar  
2 -javaagent:lombok.jar

Configuration Figure:

3. Restart eclispe can be.

4 may be incorporated in the project related lombok rely on the use:

1 <dependency>
2     <groupId>org.projectlombok</groupId>
3     <artifactId>lombok</artifactId>
4     <version>1.18.4</version>
5 </dependency>

lombok commonly used notes are:

. 1  @Data: annotation on the class; Getting class provides all of the attributes and setting methods, in addition to providing the equals,        
 2    canEqual, the hashCode, toString methods
 . 3  @Setter: annotations on attribute; property provides for the setting method
 . 4  @Getter: annotation on the property; getting provides a method for the property
 . 5  @ log4j: annotation on the class; log4j log object provides a class attribute called the log
 . 6  @NoArgsConstructor: annotation on the class; class provides a no-argument constructor
 7  @AllArgsConstructor: annotation on the class; class provide a full-argument constructor

Note: https: //www.cnblogs.com/heyonggang/p/8638374.html (explain in more detail, do reference)

 

Guess you like

Origin www.cnblogs.com/JamieLove/p/11111721.html