X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fdata%2Fimpl%2FPostReplyBuilderImpl.java;h=dac84addaf62186ff388b76337a6d8d3f576fdd8;hb=7df20dec7dcc9aa6d1aa657d24f273e1a82c60fc;hp=c4e6bff5a69b8c8dd8c613ddff54d00dfd119f52;hpb=83ceb7c20927ae3cd9eb12d8d885462ac66ea6a4;p=Sone.git
diff --git a/src/main/java/net/pterodactylus/sone/data/impl/PostReplyBuilderImpl.java b/src/main/java/net/pterodactylus/sone/data/impl/PostReplyBuilderImpl.java
index c4e6bff..dac84ad 100644
--- a/src/main/java/net/pterodactylus/sone/data/impl/PostReplyBuilderImpl.java
+++ b/src/main/java/net/pterodactylus/sone/data/impl/PostReplyBuilderImpl.java
@@ -21,9 +21,10 @@ import static com.google.common.base.Preconditions.checkState;
import java.util.UUID;
-import net.pterodactylus.sone.core.PostProvider;
import net.pterodactylus.sone.data.PostReply;
-import net.pterodactylus.sone.data.PostReplyBuilder;
+import net.pterodactylus.sone.database.PostProvider;
+import net.pterodactylus.sone.database.PostReplyBuilder;
+import net.pterodactylus.sone.database.SoneProvider;
import org.apache.commons.lang.StringUtils;
@@ -33,21 +34,24 @@ import org.apache.commons.lang.StringUtils;
*
* @author David âBombeâ Roden
*/
-public class PostReplyBuilderImpl extends AbstractReplyBuilder implements PostReplyBuilder {
+public class PostReplyBuilderImpl extends AbstractPostReplyBuilder {
- /** The post builder. */
- private final PostProvider postProvider;
+ /** The Sone provider. */
+ private final SoneProvider soneProvider;
- /** The ID of the post the created reply refers to. */
- private String postId;
+ /** The post provider. */
+ private final PostProvider postProvider;
/**
* Creates a new post reply builder.
*
+ * @param soneProvider
+ * The Sone provider
* @param postProvider
* The post provider
*/
- public PostReplyBuilderImpl(PostProvider postProvider) {
+ public PostReplyBuilderImpl(SoneProvider soneProvider, PostProvider postProvider) {
+ this.soneProvider = soneProvider;
this.postProvider = postProvider;
}
@@ -55,23 +59,15 @@ public class PostReplyBuilderImpl extends AbstractReplyBuilder
* {@inheritDoc}
*/
@Override
- public PostReplyBuilder to(String postId) {
- this.postId = postId;
- return this;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
public PostReply build() {
checkState((randomId && (id == null)) || (!randomId && (id != null)), "either random ID nor custom ID must be set");
- checkState(sender != null, "sender must not be null");
+ checkState(senderId != null, "sender must not be null");
checkState((currentTime && (time == 0)) || (!currentTime && (time >= 0)), "either current time or custom time must be set");
checkState(!StringUtils.isBlank(text), "text must not be empty");
checkState(postId != null, "post must not be null");
/* create new post reply. */
- return new PostReplyImpl(postProvider, randomId ? UUID.randomUUID().toString() : id, sender, currentTime ? System.currentTimeMillis() : time, text, postId);
+ return new PostReplyImpl(soneProvider, postProvider, randomId ? UUID.randomUUID().toString() : id, senderId, currentTime ? System.currentTimeMillis() : time, text, postId);
}
+
}