Actually return a Sone builder.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sun, 20 Oct 2013 00:09:43 +0000 (02:09 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 28 Feb 2014 21:25:31 +0000 (22:25 +0100)
src/main/java/net/pterodactylus/sone/database/memory/MemoryDatabase.java

index 9edab57..a935b75 100644 (file)
@@ -44,6 +44,7 @@ import net.pterodactylus.sone.data.Post;
 import net.pterodactylus.sone.data.PostReply;
 import net.pterodactylus.sone.data.Reply;
 import net.pterodactylus.sone.data.Sone;
+import net.pterodactylus.sone.data.impl.DefaultSoneBuilder;
 import net.pterodactylus.sone.database.Database;
 import net.pterodactylus.sone.database.DatabaseException;
 import net.pterodactylus.sone.database.PostDatabase;
@@ -216,7 +217,14 @@ public class MemoryDatabase extends AbstractService implements Database {
 
        @Override
        public SoneBuilder newSoneBuilder() {
-               return null;
+               return new DefaultSoneBuilder(this) {
+                       @Override
+                       public Sone build(Optional<SoneCreated> soneCreated) throws IllegalStateException {
+                               Sone sone = super.build(soneCreated);
+                               sones.put(sone.getId(), sone);
+                               return sone;
+                       }
+               };
        }
 
        //