From: David ‘Bombe’ Roden Date: Wed, 13 Oct 2010 09:12:03 +0000 (+0200) Subject: Add unique ID for the Sone. X-Git-Tag: 0.1-RC1~505 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=2284032867d6f03bf4eb7c70204ec33bd39ed006;p=Sone.git Add unique ID for the Sone. --- diff --git a/src/main/java/net/pterodactylus/sone/data/Sone.java b/src/main/java/net/pterodactylus/sone/data/Sone.java index b194bcb..b969bd4 100644 --- a/src/main/java/net/pterodactylus/sone/data/Sone.java +++ b/src/main/java/net/pterodactylus/sone/data/Sone.java @@ -20,6 +20,7 @@ package net.pterodactylus.sone.data; import java.util.Collections; import java.util.HashSet; import java.util.Set; +import java.util.UUID; import freenet.keys.FreenetURI; @@ -31,6 +32,9 @@ import freenet.keys.FreenetURI; */ public class Sone { + /** A GUID for this Sone. */ + private final UUID id = UUID.randomUUID(); + /** The URI under which the Sone is stored in Freenet. */ private final FreenetURI requestUri; @@ -69,6 +73,15 @@ public class Sone { // /** + * Returns the ID of this Sone. + * + * @return The ID of this Sone + */ + public String getId() { + return id.toString(); + } + + /** * Returns the request URI of this Sone. * * @return The request URI of this Sone @@ -140,8 +153,7 @@ public class Sone { */ @Override public int hashCode() { - /* TODO improve */ - return requestUri.hashCode(); + return id.hashCode(); } }