From the course: IntelliJ IDEA Community Edition Essential Training
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Generate boilerplate code
From the course: IntelliJ IDEA Community Edition Essential Training
Generate boilerplate code
IntelliJ IDEA let's you generate code there are tools for generating new properties and new boiler plate code that's common in Java and other languages. Now to follow along, start with a simple class I've created a class called person and I'm going to add some fields to this class. I'll make them private I'll start by typing the word private and then the first one will be a string and I'll call it first name. Then I'll create another string and I'll call that last name and then I'll create an integer field and I'll name that age. In Java you'll typically want to create setter and getter methods and this will be the first example of how you can generate code. I'll place the cursor on that last line then I'll go to the menu and I'll choose code generate and notice that there's a keyboard shortcut associated with this action. Now I'll select getter and setter and I'll see this dialog pop-up I'll hold down the shift…
Contents
-
-
-
-
-
Create new packages, classes, and interfaces1m 30s
-
(Locked)
Generate boilerplate code2m 49s
-
(Locked)
Reformat code and optimize imports4m 34s
-
(Locked)
Navigate code and find files2m 39s
-
(Locked)
Refactor code4m 1s
-
(Locked)
Create and use live templates2m 34s
-
(Locked)
Store code in scratch files2m 22s
-
(Locked)
Challenge: Create a class that represents a data object1m 9s
-
(Locked)
Solution: Create a class that represents a data object3m 10s
-
-
-
-
-
-