Skip to content

Commit 80b0bd2

Browse files
committed
[java][booking][03_preserve_object] Preserve Customer object
1 parent 321d3a8 commit 80b0bd2

File tree

1 file changed

+8
-12
lines changed
  • examples/java/java-booking-03_preserve_whole_object/src/main/java/tv/codely/booking

1 file changed

+8
-12
lines changed

examples/java/java-booking-03_preserve_whole_object/src/main/java/tv/codely/booking/Booking.java

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ public final class Booking {
66
private final BookingId id;
77
private final LocalDateTime startDate;
88
private final LocalDateTime endDate;
9-
private final CustomerId customerId;
10-
private final CustomerName customerName;
11-
private final EmailAddress customerEmail;
9+
private final Customer customer;
1210
private final BookingType bookingType;
1311
private final Discount discount;
1412
private final Tax tax;
@@ -21,15 +19,13 @@ public Booking(
2119
Discount discount,
2220
Tax tax
2321
) {
24-
this.id = id;
25-
this.startDate = bookingDateRange.startDate();
26-
this.endDate = bookingDateRange.endDate();
27-
this.customerId = customer.id();
28-
this.customerName = customer.name();
29-
this.customerEmail = customer.emailAddress();
30-
this.bookingType = bookingType;
31-
this.discount = discount;
32-
this.tax = tax;
22+
this.id = id;
23+
this.startDate = bookingDateRange.startDate();
24+
this.endDate = bookingDateRange.endDate();
25+
this.customer = customer;
26+
this.bookingType = bookingType;
27+
this.discount = discount;
28+
this.tax = tax;
3329
}
3430

3531
public BookingStatus statusFor(LocalDateTime date) {

0 commit comments

Comments
 (0)