File tree Expand file tree Collapse file tree
axon/src/main/java/com/baeldung/axon Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package com .baeldung .axon .commands ;
22
3+ import java .util .Objects ;
34
4- import org .axonframework .commandhandling .TargetAggregateIdentifier ;
5+ import org .axonframework .modelling . command .TargetAggregateIdentifier ;
56
67public class CreateMessageCommand {
7-
8+
89 @ TargetAggregateIdentifier
910 private final String id ;
1011 private final String text ;
11-
12+
1213 public CreateMessageCommand (String id , String text ) {
1314 this .id = id ;
1415 this .text = text ;
1516 }
16-
17+
1718 public String getId () {
1819 return id ;
1920 }
20-
21+
2122 public String getText () {
2223 return text ;
2324 }
25+
26+ @ Override
27+ public boolean equals (Object o ) {
28+ if (this == o ) {
29+ return true ;
30+ }
31+ if (o == null || getClass () != o .getClass ()) {
32+ return false ;
33+ }
34+ CreateMessageCommand that = (CreateMessageCommand ) o ;
35+ return Objects .equals (id , that .id ) && Objects .equals (text , that .text );
36+ }
37+
38+ @ Override
39+ public int hashCode () {
40+ return Objects .hash (id , text );
41+ }
2442}
Original file line number Diff line number Diff line change 11package com .baeldung .axon .commands ;
22
3+ import java .util .Objects ;
34
4- import org .axonframework .commandhandling .TargetAggregateIdentifier ;
5+ import org .axonframework .modelling . command .TargetAggregateIdentifier ;
56
67public class MarkReadMessageCommand {
7-
8+
89 @ TargetAggregateIdentifier
910 private final String id ;
10-
11+
1112 public MarkReadMessageCommand (String id ) {
1213 this .id = id ;
1314 }
14-
15+
1516 public String getId () {
1617 return id ;
1718 }
19+
20+ @ Override
21+ public boolean equals (Object o ) {
22+ if (this == o ) {
23+ return true ;
24+ }
25+ if (o == null || getClass () != o .getClass ()) {
26+ return false ;
27+ }
28+ MarkReadMessageCommand that = (MarkReadMessageCommand ) o ;
29+ return Objects .equals (id , that .id );
30+ }
31+
32+ @ Override
33+ public int hashCode () {
34+ return Objects .hash (id );
35+ }
1836}
Original file line number Diff line number Diff line change 11package com .baeldung .axon .events ;
22
3+ import java .util .Objects ;
4+
35public class MessageCreatedEvent {
4-
6+
57 private final String id ;
68 private final String text ;
7-
9+
810 public MessageCreatedEvent (String id , String text ) {
911 this .id = id ;
1012 this .text = text ;
1113 }
12-
14+
1315 public String getId () {
1416 return id ;
1517 }
16-
18+
1719 public String getText () {
1820 return text ;
1921 }
22+
23+ @ Override
24+ public boolean equals (Object o ) {
25+ if (this == o ) {
26+ return true ;
27+ }
28+ if (o == null || getClass () != o .getClass ()) {
29+ return false ;
30+ }
31+ MessageCreatedEvent that = (MessageCreatedEvent ) o ;
32+ return Objects .equals (id , that .id ) && Objects .equals (text , that .text );
33+ }
34+
35+ @ Override
36+ public int hashCode () {
37+ return Objects .hash (id , text );
38+ }
2039}
Original file line number Diff line number Diff line change 11package com .baeldung .axon .events ;
22
3+ import java .util .Objects ;
4+
35public class MessageReadEvent {
4-
6+
57 private final String id ;
6-
8+
79 public MessageReadEvent (String id ) {
810 this .id = id ;
911 }
10-
12+
1113 public String getId () {
1214 return id ;
1315 }
16+
17+ @ Override
18+ public boolean equals (Object o ) {
19+ if (this == o ) {
20+ return true ;
21+ }
22+ if (o == null || getClass () != o .getClass ()) {
23+ return false ;
24+ }
25+ MessageReadEvent that = (MessageReadEvent ) o ;
26+ return Objects .equals (id , that .id );
27+ }
28+
29+ @ Override
30+ public int hashCode () {
31+ return Objects .hash (id );
32+ }
1433}
You can’t perform that action at this time.
0 commit comments