aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack/conversationsplus
diff options
context:
space:
mode:
authorsteckbrief <steckbrief@chefmail.de>2015-12-11 00:27:27 +0100
committersteckbrief <steckbrief@chefmail.de>2015-12-11 00:27:27 +0100
commit74b7588e624de7c22eb602fca1c4aa9ef25f2c4c (patch)
treeb05c8cde30d88d6a6befbffbd35a6c1588d102d4 /src/main/java/de/thedevstack/conversationsplus
parent3b1723dcf19dc6e3390df63a71df903d9cb7dd94 (diff)
parent258732c9dfe2d1dde770a6117b104267fe434d67 (diff)
Merge remote-tracking branch 'remotes/origin/trz/rename' into trz/rebase
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus')
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/dto/SrvRecord.java53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/dto/SrvRecord.java b/src/main/java/de/thedevstack/conversationsplus/dto/SrvRecord.java
new file mode 100644
index 00000000..3bc79c4f
--- /dev/null
+++ b/src/main/java/de/thedevstack/conversationsplus/dto/SrvRecord.java
@@ -0,0 +1,53 @@
+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;
+
+ public SrvRecord(int priority, String name, int port) {
+ this.priority = priority;
+ this.name = name;
+ this.port = port;
+ }
+
+ /**
+ * 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;
+ }
+}