1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.fourthline.cling.model.types;
17
18
19
20
21
22
23 public class HostPort {
24
25 private String host;
26 private int port;
27
28 public HostPort() {
29 }
30
31 public HostPort(String host, int port) {
32 this.host = host;
33 this.port = port;
34 }
35
36 public String getHost() {
37 return host;
38 }
39
40 public void setHost(String host) {
41 this.host = host;
42 }
43
44 public int getPort() {
45 return port;
46 }
47
48 public void setPort(int port) {
49 this.port = port;
50 }
51
52 @Override
53 public boolean equals(Object o) {
54 if (this == o) return true;
55 if (o == null || getClass() != o.getClass()) return false;
56
57 HostPort hostPort = (HostPort) o;
58
59 if (port != hostPort.port) return false;
60 if (!host.equals(hostPort.host)) return false;
61
62 return true;
63 }
64
65 @Override
66 public int hashCode() {
67 int result = host.hashCode();
68 result = 31 * result + port;
69 return result;
70 }
71
72 @Override
73 public String toString() {
74 return host + ":" + port;
75 }
76 }