Skip to content

Commit f937680

Browse files
committed
feat: repleace color to enum as String
Signed-off-by: Otavio Santana <[email protected]>
1 parent dd6f360 commit f937680

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/main/java/com/otaviojava/demos/ddd/Car.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import jakarta.nosql.Id;
66
import net.datafaker.providers.base.Vehicle;
77

8-
import java.time.Year;
98
import java.util.Objects;
109

1110
@Entity
@@ -21,13 +20,13 @@ public class Car {
2120
private Manufacturer manufacturer;
2221

2322
@Column
24-
private Color color;
23+
private String color;
2524

2625
@Deprecated
2726
Car() {
2827
}
2928

30-
Car(String vin, String transmission, Manufacturer manufacturer, Color color) {
29+
Car(String vin, String transmission, Manufacturer manufacturer, String color) {
3130
this.vin = vin;
3231
this.transmission = transmission;
3332
this.manufacturer = manufacturer;
@@ -46,7 +45,7 @@ public Manufacturer getManufacturer() {
4645
return manufacturer;
4746
}
4847

49-
public Color getColor() {
48+
public String getColor() {
5049
return color;
5150
}
5251

@@ -83,7 +82,7 @@ public static Car of(Vehicle vehicle) {
8382
.vin(vehicle.vin())
8483
.transmission(vehicle.transmission())
8584
.manufacturer(new Manufacturer(vehicle.manufacturer(), vehicle.model()))
86-
.color(Color.valueOf(vehicle.color().toUpperCase()))
85+
.color(vehicle.color().toUpperCase())
8786
.build();
8887
}
8988
}

src/main/java/com/otaviojava/demos/ddd/CarBuilder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ public class CarBuilder {
55
private String vin;
66
private String transmission;
77
private Manufacturer manufacturer;
8-
private Color color;
8+
private String color;
99

1010
CarBuilder() {
1111
}
@@ -25,7 +25,7 @@ public CarBuilder manufacturer(Manufacturer manufacturer) {
2525
return this;
2626
}
2727

28-
public CarBuilder color(Color color) {
28+
public CarBuilder color(String color) {
2929
this.color = color;
3030
return this;
3131
}

0 commit comments

Comments
 (0)