1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.newsclub.net.unix.rmi;
19
20 import java.rmi.RemoteException;
21 import java.util.Objects;
22
23
24
25
26
27
28 final class AFNamingRef {
29 private final AFNamingProvider<?> provider;
30 private final int port;
31
32 AFNamingRef(AFNamingProvider<?> provider, int port) throws RemoteException {
33 this.provider = provider;
34 this.port = port;
35 }
36
37 @Override
38 public int hashCode() {
39 return Objects.hash(port, provider);
40 }
41
42 @Override
43 public boolean equals(Object obj) {
44 if (this == obj) {
45 return true;
46 }
47 if (!(obj instanceof AFNamingRef)) {
48 return false;
49 }
50 AFNamingRef other = (AFNamingRef) obj;
51 return port == other.port && Objects.equals(provider, other.provider);
52 }
53 }