blob: 1e0eebc795e20c990c39aa4c43f0cee4bc032cfa (
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
package de.thedevstack.conversationsplus.dto;
/**
* An SRV record as it is currently used in Conversations Plus.
* The weight of the SRV record is skipped.
*/
public class SrvRecord implements Comparable<SrvRecord> {
private int priority;
private String name;
private int port;
private boolean useTls = false;
public SrvRecord(int priority, String name, int port) {
this.priority = priority;
this.name = name;
this.port = port;
}
public SrvRecord(int priority, String name, int port, boolean useTls) {
this.priority = priority;
this.name = name;
this.port = port;
this.useTls = useTls;
}
/**
* Compares this record to the specified record to determine their relative
* order.
*
* @param another the object to compare to this instance.
* @return a negative integer if the priority of this record is lower than the priority of {@code another};
* a positive integer if the priority of this record is higher than
* {@code another}; 0 if the priority of this record is equal to the priority of
* {@code another}.
*/
@Override
public int compareTo(SrvRecord another) {
return this.getPriority() < another.getPriority() ? -1 : (this.getPriority() == another.getPriority() ? 0 : 1);
}
@Override
public String toString() {
return "SrvRecord{" +
"priority=" + priority +
", name='" + name + '\'' +
", port=" + port +
'}';
}
public String getName() {
return name;
}
public int getPort() {
return port;
}
public int getPriority() {
return priority;
}
public boolean isUseTls() {
return useTls;
}
}
|