@@ -37,8 +37,16 @@ public class AdminMessage extends TypedData {
37
37
private Admin admin ;
38
38
39
39
@ JsonProperty ("to" )
40
+ private TypedData to (){
41
+ if (user != null ) return user ;
42
+ if (contact != null ) return contact ;
43
+ return null ;
44
+ };
45
+
40
46
private User user ;
41
47
48
+ private Contact contact ;
49
+
42
50
public AdminMessage () {
43
51
}
44
52
@@ -121,6 +129,15 @@ public AdminMessage setUser(User user) {
121
129
return this ;
122
130
}
123
131
132
+ public Contact getContact () {
133
+ return contact ;
134
+ }
135
+
136
+ public AdminMessage setContact (Contact contact ) {
137
+ this .contact = contact ;
138
+ return this ;
139
+ }
140
+
124
141
@ Override
125
142
public boolean equals (Object o ) {
126
143
if (this == o ) return true ;
@@ -138,6 +155,7 @@ public boolean equals(Object o) {
138
155
if (!type .equals (message .type )) return false ;
139
156
//noinspection RedundantIfStatement
140
157
if (user != null ? !user .equals (message .user ) : message .user != null ) return false ;
158
+ if (contact != null ? !contact .equals (message .contact ) : message .contact != null ) return false ;
141
159
142
160
return true ;
143
161
}
@@ -153,6 +171,7 @@ public int hashCode() {
153
171
result = 31 * result + (int ) (createdAt ^ (createdAt >>> 32 ));
154
172
result = 31 * result + (admin != null ? admin .hashCode () : 0 );
155
173
result = 31 * result + (user != null ? user .hashCode () : 0 );
174
+ result = 31 * result + (contact != null ? contact .hashCode () : 0 );
156
175
return result ;
157
176
}
158
177
@@ -167,6 +186,7 @@ public String toString() {
167
186
", createdAt=" + createdAt +
168
187
", admin=" + admin +
169
188
", user=" + user +
189
+ ", contact=" + contact +
170
190
"} " + super .toString ();
171
191
}
172
192
0 commit comments