|
1 | 1 | package io.axoniq.dev.samples.api;
|
2 | 2 |
|
3 | 3 | import java.util.Map;
|
4 |
| -import java.util.Objects; |
5 | 4 |
|
6 | 5 | /**
|
7 | 6 | * An old event of the flight domain that's now been deprecated.
|
8 | 7 | * <p>
|
9 | 8 | * This event contained a complete list of all the passenger seat adjustments of a flight in one go. As time passed, the
|
10 |
| - * application developers noticed they required an event for every separate change. Hence, they introduced that {@link |
11 |
| - * PassengerSeatAdjustedEvent} and added a one-to-many upcaster to make this adjustment. |
| 9 | + * application developers noticed they required an event for every separate change. Hence, they introduced that |
| 10 | + * {@link PassengerSeatAdjustedEvent} and added a one-to-many upcaster to make this adjustment. |
12 | 11 | *
|
13 | 12 | * @author Steven van Beelen
|
14 | 13 | * @see io.axoniq.dev.samples.upcaster.json.PassengerSeatsToPassengerSeatAdjustedEventUpcaster
|
15 | 14 | * @deprecated in favor of singular {@link PassengerSeatAdjustedEvent}s
|
16 | 15 | */
|
17 | 16 | @Deprecated
|
18 |
| -public class PassengerSeatsAdjustedEvent { |
| 17 | +public record PassengerSeatsAdjustedEvent( |
| 18 | + String flightId, |
| 19 | + Map<String, Integer> passengerSeats |
| 20 | +) { |
19 | 21 |
|
20 |
| - private final String flightId; |
21 |
| - private final Map<String, Integer> passengerSeats; |
22 |
| - |
23 |
| - public PassengerSeatsAdjustedEvent(String flightId, Map<String, Integer> passengerSeats) { |
24 |
| - this.flightId = flightId; |
25 |
| - this.passengerSeats = passengerSeats; |
26 |
| - } |
27 |
| - |
28 |
| - public String getFlightId() { |
29 |
| - return flightId; |
30 |
| - } |
31 |
| - |
32 |
| - public Map<String, Integer> getPassengerSeats() { |
33 |
| - return passengerSeats; |
34 |
| - } |
35 |
| - |
36 |
| - @Override |
37 |
| - public boolean equals(Object o) { |
38 |
| - if (this == o) { |
39 |
| - return true; |
40 |
| - } |
41 |
| - if (o == null || getClass() != o.getClass()) { |
42 |
| - return false; |
43 |
| - } |
44 |
| - PassengerSeatsAdjustedEvent that = (PassengerSeatsAdjustedEvent) o; |
45 |
| - return Objects.equals(flightId, that.flightId) && Objects.equals(passengerSeats, that.passengerSeats); |
46 |
| - } |
47 |
| - |
48 |
| - @Override |
49 |
| - public int hashCode() { |
50 |
| - return Objects.hash(flightId, passengerSeats); |
51 |
| - } |
52 |
| - |
53 |
| - @Override |
54 |
| - public String toString() { |
55 |
| - return "PassengerSeatsAdjustedEvent{" + |
56 |
| - "flightId='" + flightId + '\'' + |
57 |
| - ", passengerSeats=" + passengerSeats + |
58 |
| - '}'; |
59 |
| - } |
60 | 22 | }
|
0 commit comments