1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package io.netty.example.stomp.websocket;
17
18 import io.netty.channel.Channel;
19 import io.netty.util.internal.ObjectUtil;
20
21 public final class StompSubscription {
22
23 private final String id;
24 private final String destination;
25 private final Channel channel;
26
27 public StompSubscription(String id, String destination, Channel channel) {
28 this.id = ObjectUtil.checkNotNull(id, "id");
29 this.destination = ObjectUtil.checkNotNull(destination, "destination");
30 this.channel = ObjectUtil.checkNotNull(channel, "channel");
31 }
32
33 public String id() {
34 return id;
35 }
36
37 public String destination() {
38 return destination;
39 }
40
41 public Channel channel() {
42 return channel;
43 }
44
45 @Override
46 public boolean equals(Object obj) {
47 if (this == obj) {
48 return true;
49 }
50
51 if (obj == null || getClass() != obj.getClass()) {
52 return false;
53 }
54
55 StompSubscription that = (StompSubscription) obj;
56
57 if (!id.equals(that.id)) {
58 return false;
59 }
60
61 if (!destination.equals(that.destination)) {
62 return false;
63 }
64
65 return channel.equals(that.channel);
66 }
67
68 @Override
69 public int hashCode() {
70 int result = id.hashCode();
71 result = 31 * result + destination.hashCode();
72 result = 31 * result + channel.hashCode();
73 return result;
74 }
75 }