X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fdata%2FPost.java;h=6523e9b8cfcf848b062aa32d9b7ff185bdd47246;hb=fcd65a08073768114e9d1943aea2fd41bbc5fa61;hp=160bb3284e330b55b646409723ab22e54be2701f;hpb=8503021c00d63885288c507d9930fefabd5d7678;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..6523e9b 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; /** @@ -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.