Make post reply returned by provider optional.
[Sone.git] / src / main / java / net / pterodactylus / sone / core / PostReplyProvider.java
index ddf3317..5decdc7 100644 (file)
 
 package net.pterodactylus.sone.core;
 
+import java.util.List;
+
+import net.pterodactylus.sone.data.Post;
 import net.pterodactylus.sone.data.PostReply;
 
+import com.google.common.base.Optional;
+
 /**
- * Interface for objects that can provide {@link PostReply}s by their ID.
+ * Interface for objects that can provide {@link PostReply}s.
  *
  * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
  */
 public interface PostReplyProvider {
 
        /**
-        * Returns the post reply with the given ID, if it exists. If it does not
-        * exist and {@code create} is {@code false}, {@code null} is returned;
-        * otherwise, a new post reply with the given ID is created and returned.
+        * Returns the reply with the given ID.
+        *
+        * @param id
+        *            The ID of the reply to get
+        * @return The reply, or {@code null} if there is no such reply
+        */
+       public Optional<PostReply> getPostReply(String id);
+
+       /**
+        * Returns all replies for the given post, order ascending by time.
         *
-        * @param replyId
-        *            The ID of the post reply to return
-        * @param create
-        *            {@code true} to create a new post reply if no post reply with
-        *            the given ID exists, {@code false} to return {@code null}
-        *            instead
-        * @return The post reply with the given ID, or {@code null}
+        * @param post
+        *            The post to get all replies for
+        * @return All replies for the given post
         */
-       public PostReply getPostReply(String replyId, boolean create);
+       public List<PostReply> getReplies(Post post);
 
 }