1
2
3
4
5 package org.sourceforge.jemm.database;
6
7
8
9
10
11
12 public class ClientThreadId {
13 private final ClientId clientId;
14 private final String threadId;
15
16
17
18
19
20 public ClientThreadId(ClientId clientId, String threadId) {
21 if(clientId == null)
22 throw new IllegalArgumentException("clientId may not be null");
23
24 if(threadId == null)
25 throw new IllegalArgumentException("threadId may not be null");
26 this.clientId = clientId;
27 this.threadId = threadId;
28 }
29
30 @Override
31 public int hashCode() {
32 return clientId.hashCode() + threadId.hashCode();
33 }
34
35 @Override
36 public boolean equals(Object obj) {
37 if (this == obj)
38 return true;
39 if (obj == null)
40 return false;
41 if (getClass() != obj.getClass())
42 return false;
43
44 ClientThreadId other = (ClientThreadId) obj;
45 return clientId.equals(other.clientId) && threadId.equals(other.threadId);
46 }
47
48 @Override
49 public String toString() {
50 return "ClientThreadId("+ clientId + ',' + threadId + ')';
51 }
52
53 public ClientId getClientId() {
54 return clientId;
55 }
56
57 public String getThreadId() {
58 return threadId;
59 }
60 }