lombok component
The main function of the lombok component is to make the written code more elegant, (the essence is to quickly help us write the getter setter method toString method construction method, as well as the log framework tool class.
The first step: idea development tool to install Plugins plug-in
Step 2: Set the current project to enable the annotation function and apply it
Step 3: On the current project module, add the lombok.jar component dependency.
Download the lombok.jar dependency. Address: http://projectlombok.org
If it is a maven project, then it is relatively simple, just configure it in the pom.xml file. Now we are an ordinary project of idea java, so we need to download lombok.jar by ourselves, and then add it.
Add dependencies:
Once added, it can be applied.
Create a Book class.
@Data//封装
@AllArgsConstructor//有参构造
@NoArgsConstructor//无参构造
public class Book {
private String bookName;
private String author;
private String type;
private LocalDateTime protime;
}
Use the shortcut key alt+7 to view
The GenerateAllSetter plugin uses
The first step: idea development tool to install Plugins plug-in
Step 2: Restart the idea development tool, and then it can be used.
Taking the above Book as an example, create a BookDemo class. Just put the mouse on the book and use the shortcut key Alt+Enter.