git://wamblee.org
/
xmlrouter
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
First version after introduction of meaningful ids and Identifiable interface.
[xmlrouter]
/
common
/
src
/
main
/
java
/
org
/
wamblee
/
xmlrouter
/
common
/
Id.java
diff --git
a/common/src/main/java/org/wamblee/xmlrouter/common/Id.java
b/common/src/main/java/org/wamblee/xmlrouter/common/Id.java
index f057b416ee8572570b018fd83594fa40869ffd63..1d31c8bab25115da24949ae4383326681a17f3d2 100644
(file)
--- a/
common/src/main/java/org/wamblee/xmlrouter/common/Id.java
+++ b/
common/src/main/java/org/wamblee/xmlrouter/common/Id.java
@@
-25,28
+25,33
@@
package org.wamblee.xmlrouter.common;
*/
public class Id<T> implements Comparable<Id<T>> {
*/
public class Id<T> implements Comparable<Id<T>> {
- private
lo
ng id;
+ private
Stri
ng id;
/**
* Constructs the id.
*
* @param aId
* Integer id.
/**
* Constructs the id.
*
* @param aId
* Integer id.
+ * @throws NullPointerException
+ * in case the id is null.
*/
*/
- public Id(long aId) {
+ public Id(String aId) {
+ if (aId == null) {
+ throw new NullPointerException("id is null");
+ }
id = aId;
}
/**
* @return The underlying id.
*/
id = aId;
}
/**
* @return The underlying id.
*/
- public
lo
ng getId() {
+ public
Stri
ng getId() {
return id;
}
@Override
public int hashCode() {
return id;
}
@Override
public int hashCode() {
- return
((Long) id)
.hashCode();
+ return
id
.hashCode();
}
@Override
}
@Override
@@
-62,11
+67,11
@@
public class Id<T> implements Comparable<Id<T>> {
@Override
public String toString() {
@Override
public String toString() {
- return id
+ ""
;
+ return id;
}
@Override
public int compareTo(Id<T> aId) {
}
@Override
public int compareTo(Id<T> aId) {
- return
((Long) id).compareTo((Long)
aId.getId());
+ return
id.compareTo(
aId.getId());
}
}
}
}