X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fdata%2FPost.java;h=5269fe46f15ee9dcd796639844090b80d507bc74;hp=160bb3284e330b55b646409723ab22e54be2701f;hb=45803a1c678d6811f7bbf85d50c79844031be0f0;hpb=33cc85447797301e299e7ac444fe53538f09a69d diff --git a/src/main/java/net/pterodactylus/sone/data/Post.java b/src/main/java/net/pterodactylus/sone/data/Post.java index 160bb32..5269fe4 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,31 @@ public interface Post { public Sone getSone(); /** - * Returns the recipient of this post, if any. + * Returns whether this post has a recipient. * - * @return The recipient of this post, or {@code null} + * @return {@code true} if this post has a recipient, {@code false} + * otherwise */ - public Sone getRecipient(); + public boolean hasRecipient(); + + /** + * Returns the ID of the recipient {@link Sone}, or + * {@link Optional#absent()} if this post does not have a recipient. + * + * @return The ID of the recipient, or {@link Optional#absent()} + */ + 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.