*/
package org.wamblee.xmlrouter.common;
-public class Id<T> {
+/**
+ * This class provides a generic typesafe id wrapping a long value.
+ *
+ * @author Erik Brakkee
+ *
+ * @param <T>
+ * Type the id refers to.
+ */
+public class Id<T> implements Comparable<Id<T>> {
private long id;
+ /**
+ * Constructs the id.
+ *
+ * @param aId
+ * Integer id.
+ */
public Id(long aId) {
id = aId;
}
+ /**
+ * @return The underlying id.
+ */
public long getId() {
return id;
}
public String toString() {
return id + "";
}
+
+ @Override
+ public int compareTo(Id<T> aId) {
+ return ((Long) id).compareTo((Long) aId.getId());
+ }
}