X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fdatabase%2Fmemory%2FMemoryPost.java;h=451b6b50c04517c3ca3c21d62c12732737a6a8f2;hp=180cf6c4cc33e2b26a1b1954900187fd0714e2e2;hb=faf66247a34f64946990a985d2ea3003465969cb;hpb=0e8f7804ce344bdd69f5ecc7febe25a60a53561d diff --git a/src/main/java/net/pterodactylus/sone/database/memory/MemoryPost.java b/src/main/java/net/pterodactylus/sone/database/memory/MemoryPost.java index 180cf6c..451b6b5 100644 --- a/src/main/java/net/pterodactylus/sone/database/memory/MemoryPost.java +++ b/src/main/java/net/pterodactylus/sone/database/memory/MemoryPost.java @@ -1,5 +1,5 @@ /* - * Sone - PostImpl.java - Copyright © 2010–2013 David Roden + * Sone - MemoryPost.java - Copyright © 2010–2020 David Roden * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,6 +17,8 @@ package net.pterodactylus.sone.database.memory; +import static com.google.common.base.Optional.fromNullable; + import java.util.UUID; import net.pterodactylus.sone.data.Post; @@ -28,8 +30,6 @@ import com.google.common.base.Optional; /** * A post is a short message that a user writes in his Sone to let other users * know what is going on. - * - * @author David ‘Bombe’ Roden */ class MemoryPost implements Post { @@ -104,7 +104,7 @@ class MemoryPost implements Post { */ @Override public Sone getSone() { - return soneProvider.getSone(soneId).get(); + return soneProvider.getSone(soneId); } /** @@ -112,7 +112,7 @@ class MemoryPost implements Post { */ @Override public Optional getRecipientId() { - return Optional.fromNullable(recipientId); + return fromNullable(recipientId); } /** @@ -120,7 +120,7 @@ class MemoryPost implements Post { */ @Override public Optional getRecipient() { - return soneProvider.getSone(recipientId); + return recipientId == null ? Optional.absent() : fromNullable(soneProvider.getSone(recipientId)); } /**