blob: 03c0ef4747e054168e3b29a54d374ef228f3939e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
package kz.ilotterytea.frogartha.domain;
import com.github.czyzby.websocket.serialization.SerializationException;
import com.github.czyzby.websocket.serialization.Transferable;
import com.github.czyzby.websocket.serialization.impl.Deserializer;
import com.github.czyzby.websocket.serialization.impl.Serializer;
public class Identity implements Transferable<Identity> {
private String username;
public Identity() {
}
public Identity(String username) {
this.username = username;
}
public String getUsername() {
return username;
}
@Override
public boolean equals(Object obj) {
if (obj instanceof Identity) {
return ((Identity) obj).username.equals(username);
}
return false;
}
@Override
public String toString() {
return "Identity{" +
"username='" + username + '\'' +
'}';
}
@Override
public void serialize(Serializer serializer) throws SerializationException {
serializer.serializeString(username);
}
@Override
public Identity deserialize(Deserializer deserializer) throws SerializationException {
return new Identity(deserializer.deserializeString());
}
}
|