1, first to Lombok official website Download Lombok.jar Package: http://projectlombok.org/
2, download the following two installation methods:
1. Double-click the downloaded JAR package to install Lombok
I chose to install this way when prompted not to find any IDE, so I did not install successfully, I was installed manually. If you want to install this way, please refer to the website's video.
2.eclipse/myeclipse Manual Installation Lombok
1. Copy the Lombok.jar to the folder directory where the Myeclipse.ini/eclipse.ini resides
2. Open Eclipse.ini/myeclipse.ini, insert the following two lines on the last side and save:
-xbootclasspath/a:lombok.jar
-javaagent:lombok.jar
3. Restart Eclipse/myeclipse
3.Lombok Notes:
Lombok offers a few annotations, and can refer to the official video commentary and official documentation.
Lombok Annotations Online Help documentation: Http://projectlombok.org/features/index.
Here are a few of the Lombok annotations I commonly use:
@Data: Annotations on classes; provides getting and setting methods for all properties of a class, plus equals, canequal, Hashcode, toString methods
@Setter: annotations are on attributes; Provides setting method for attributes
@Getter: annotations are on attributes; provides getting method for attributes
@Log4j: Annotations on a class; Provides a log4j log object with a property named log for the class
@NoArgsConstructor: Annotations on a class; provides an argument-free construction method for a class
@AllArgsConstructor: Annotations are on a class; Provides a method for constructing a full parameter for a class
The following is an example of the annotation generation Getter/setter method
Import Lombok. Getter;import Lombok. Setter;public class User {@Getter @Setter public string name, @Getter @Setter public string password;public static void Mai N (string[] args) {User user = new User (); User.setname ("Zhangsan"); User.setpassword ("1111"); System.out.println (User.getname ()); System.out.println (User.getpassword ());}}
Console result is: Zhangsan
1111
Note: When using these methods, be sure to import the Lombok.jar package in the project first
Lombok annotations Generate Getter/setter methods for Java classes