From 2284032867d6f03bf4eb7c70204ec33bd39ed006 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 13 Oct 2010 11:12:03 +0200 Subject: [PATCH] Add unique ID for the Sone. --- src/main/java/net/pterodactylus/sone/data/Sone.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) 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(); } } -- 2.7.4