Skip to content

Commit 3fde35a

Browse files
authored
refactoring: Adding lombok to MVC pattern (iluwatar#2188)
* Refactor: Added lombok to data-transfer-object pattern * Refactor: Added lombok to data-transfer-object pattern * Fix: Reverting all-contributors changes * Fix: Fixing checkstyle for DTO * Fix: Fixing checkstyle for Product.java * Feature: Added lombok to MVC * Fix: Fix imports
1 parent 20ebbe0 commit 3fde35a

File tree

4 files changed

+20
-41
lines changed

4 files changed

+20
-41
lines changed

model-view-controller/src/main/java/com/iluwatar/model/view/controller/Fatigue.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,19 @@
2424
*/
2525
package com.iluwatar.model.view.controller;
2626

27+
import lombok.AllArgsConstructor;
28+
2729
/**
2830
* Fatigue enumeration.
2931
*/
32+
@AllArgsConstructor
3033
public enum Fatigue {
3134
ALERT("alert"),
3235
TIRED("tired"),
3336
SLEEPING("sleeping");
3437

3538
private final String title;
3639

37-
Fatigue(String title) {
38-
this.title = title;
39-
}
4040

4141
@Override
4242
public String toString() {

model-view-controller/src/main/java/com/iluwatar/model/view/controller/GiantModel.java

Lines changed: 11 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -24,47 +24,26 @@
2424
*/
2525
package com.iluwatar.model.view.controller;
2626

27+
import lombok.AllArgsConstructor;
28+
import lombok.Builder;
29+
import lombok.Getter;
30+
import lombok.NoArgsConstructor;
31+
import lombok.Setter;
32+
2733
/**
2834
* GiantModel contains the giant data.
2935
*/
36+
@Getter
37+
@Setter
38+
@Builder
39+
@AllArgsConstructor
40+
@NoArgsConstructor
3041
public class GiantModel {
3142

3243
private Health health;
3344
private Fatigue fatigue;
3445
private Nourishment nourishment;
3546

36-
/**
37-
* Instantiates a new GiantModel.
38-
*/
39-
public GiantModel(Health health, Fatigue fatigue, Nourishment nourishment) {
40-
this.health = health;
41-
this.fatigue = fatigue;
42-
this.nourishment = nourishment;
43-
}
44-
45-
public Health getHealth() {
46-
return health;
47-
}
48-
49-
public void setHealth(Health health) {
50-
this.health = health;
51-
}
52-
53-
public Fatigue getFatigue() {
54-
return fatigue;
55-
}
56-
57-
public void setFatigue(Fatigue fatigue) {
58-
this.fatigue = fatigue;
59-
}
60-
61-
public Nourishment getNourishment() {
62-
return nourishment;
63-
}
64-
65-
public void setNourishment(Nourishment nourishment) {
66-
this.nourishment = nourishment;
67-
}
6847

6948
@Override
7049
public String toString() {

model-view-controller/src/main/java/com/iluwatar/model/view/controller/Health.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,19 @@
2424
*/
2525
package com.iluwatar.model.view.controller;
2626

27+
import lombok.AllArgsConstructor;
28+
2729
/**
2830
* Health enumeration.
2931
*/
32+
@AllArgsConstructor
3033
public enum Health {
3134
HEALTHY("healthy"),
3235
WOUNDED("wounded"),
3336
DEAD("dead");
3437

3538
private final String title;
3639

37-
Health(String title) {
38-
this.title = title;
39-
}
4040

4141
@Override
4242
public String toString() {

model-view-controller/src/main/java/com/iluwatar/model/view/controller/Nourishment.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,19 @@
2424
*/
2525
package com.iluwatar.model.view.controller;
2626

27+
import lombok.AllArgsConstructor;
28+
2729
/**
2830
* Nourishment enumeration.
2931
*/
32+
@AllArgsConstructor
3033
public enum Nourishment {
3134
SATURATED("saturated"),
3235
HUNGRY("hungry"),
3336
STARVING("starving");
3437

3538
private final String title;
3639

37-
Nourishment(String title) {
38-
this.title = title;
39-
}
4040

4141
@Override
4242
public String toString() {

0 commit comments

Comments
 (0)