X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fdata%2FPost.java;h=4860a0197a1954e85cc60de438133703cfb6b24b;hb=f855be86d4d02a29c4603522c793a3b0eecc961c;hp=160bb3284e330b55b646409723ab22e54be2701f;hpb=da609f721e54691f27113e877a19637bd332abc3;p=Sone.git
diff --git a/src/main/java/net/pterodactylus/sone/data/Post.java b/src/main/java/net/pterodactylus/sone/data/Post.java
index 160bb32..4860a01 100644
--- a/src/main/java/net/pterodactylus/sone/data/Post.java
+++ b/src/main/java/net/pterodactylus/sone/data/Post.java
@@ -19,6 +19,7 @@ package net.pterodactylus.sone.data;
import java.util.Comparator;
+import com.google.common.base.Optional;
import com.google.common.base.Predicate;
/**
@@ -27,7 +28,7 @@ import com.google.common.base.Predicate;
*
* @author David âBombeâ Roden
*/
-public interface Post {
+public interface Post extends Identified {
/** Comparator for posts, sorts descending by time. */
public static final Comparator TIME_COMPARATOR = new Comparator() {
@@ -68,11 +69,23 @@ public interface Post {
public Sone getSone();
/**
- * Returns the recipient of this post, if any.
+ * Returns the ID of the recipient {@link Sone}, or
+ * {@link Optional#absent()} if this post does not have a recipient.
*
- * @return The recipient of this post, or {@code null}
+ * @return The ID of the recipient, or {@link Optional#absent()}
*/
- public Sone getRecipient();
+ public Optional getRecipientId();
+
+ /**
+ * Returns the recipient of this post, if any. As this method can return
+ * {@link Optional#absent()} if the post has a recipient which has not yet
+ * been loaded, it is recommended to use {@link #hasRecipient()} to check
+ * for the presence of a recipient.
+ *
+ * @return The recipient of this post, or {@link Optional#absent()} if there
+ * is no recipient
+ */
+ public Optional getRecipient();
/**
* Returns the time of the post.