Skip to content

Commit 3117c74

Browse files
committed
refactor: immplements lombok annotations
1 parent 1627189 commit 3117c74

File tree

3 files changed

+7
-68
lines changed

3 files changed

+7
-68
lines changed
Lines changed: 7 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
package com.codedifferently.lesson16.evanphilakhong;
22

3-
import org.springframework.boot.autoconfigure.SpringBootApplication;
4-
import org.springframework.context.annotation.Configuration;
5-
6-
@Configuration
7-
@SpringBootApplication(scanBasePackages = "com.codedifferently")
3+
import lombok.Getter;
4+
import lombok.Setter;
85

6+
@Getter
7+
@Setter
98
public class Formula1Car {
109
private Team team;
1110
private String[] sponsors;
@@ -33,63 +32,15 @@ public Formula1Car(Team team, String[] sponsors, String driverName, int driverNu
3332
this.isDrs = false;
3433
}
3534

36-
// setters
37-
public void setTeam(Team team) {
38-
this.team = team;
39-
}
40-
41-
public void setSponsors(String[] sponsors) {
42-
this.sponsors = sponsors;
43-
}
44-
45-
public void setDriverName(String driverName) {
46-
this.driverName = driverName;
47-
}
48-
49-
public void setDriverNum(int driverNum) {
50-
this.driverNum = driverNum;
51-
}
52-
53-
public void setCurrTyre(TyreCompound newTyre) {
54-
this.currTyre = newTyre;
55-
}
56-
57-
public void setIsDrsOn(boolean isDrs) {
58-
this.isDrs = isDrs;
59-
}
60-
61-
// getters
62-
public String getTeam() {
63-
return this.team.toString();
64-
}
65-
66-
public String[] getSponsors() {
67-
return this.sponsors;
68-
}
69-
70-
public String getDriverName() {
71-
return this.driverName;
72-
}
73-
74-
public int getDriverNum() {
75-
return this.driverNum;
76-
}
77-
78-
public TyreCompound getTyreCompound() {
79-
return this.currTyre;
80-
}
81-
82-
public boolean getIsDrsOn() {
83-
return this.isDrs;
84-
}
85-
8635
// methods
8736
public void printSponsors() {
8837
for (String sponsor : sponsors) {
8938
System.out.println(sponsor);
9039
}
9140
}
9241
public static void main(String[] args) {
93-
42+
Formula1Car formula1Car = new Formula1Car();
43+
Team team = Team.MCLAREN;
44+
formula1Car.setTeam(team);
9445
}
9546
}

lesson_16/objects/objects_app/src/main/java/com/codedifferently/lesson16/evanphilakhong/Team.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
package com.codedifferently.lesson16.evanphilakhong;
22

3-
import org.springframework.boot.autoconfigure.SpringBootApplication;
4-
import org.springframework.context.annotation.Configuration;
5-
6-
@Configuration
7-
@SpringBootApplication(scanBasePackages = "com.codedifferently")
8-
93
public enum Team {
104
ALPINE, ASTON_MARTIN, FERRARI, HASS,
115
MCLAREN, MERCEDES, VCARB, RED_BULL,
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
package com.codedifferently.lesson16.evanphilakhong;
22

3-
import org.springframework.boot.autoconfigure.SpringBootApplication;
4-
import org.springframework.context.annotation.Configuration;
5-
6-
@Configuration
7-
@SpringBootApplication(scanBasePackages = "com.codedifferently")
8-
93
enum TyreCompound {
104
SOFT, MEDIUM, HARD, INTERMEDIATE, WET
115
}

0 commit comments

Comments
 (0)