X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fdata%2Fimpl%2FPostImpl.java;h=43d7d79f29c7253c60c8a1edae178da94250e445;hp=2cc0b00583ee3e9da8ad51ca01a7defc6e9f9737;hb=8ee35ad285afaede258cb59a616218a22d4f9646;hpb=83ceb7c20927ae3cd9eb12d8d885462ac66ea6a4 diff --git a/src/main/java/net/pterodactylus/sone/data/impl/PostImpl.java b/src/main/java/net/pterodactylus/sone/data/impl/PostImpl.java index 2cc0b00..43d7d79 100644 --- a/src/main/java/net/pterodactylus/sone/data/impl/PostImpl.java +++ b/src/main/java/net/pterodactylus/sone/data/impl/PostImpl.java @@ -34,16 +34,16 @@ public class PostImpl implements Post { private final UUID id; /** The Sone this post belongs to. */ - private volatile Sone sone; + private final Sone sone; /** The Sone of the recipient. */ - private volatile Sone recipient; + private final Sone recipient; /** The time of the post (in milliseconds since Jan 1, 1970 UTC). */ - private volatile long time; + private final long time; /** The text of the post. */ - private volatile String text; + private final String text; /** Whether the post is known. */ private volatile boolean known; @@ -53,52 +53,19 @@ public class PostImpl implements Post { * * @param id * The ID of the post - */ - public PostImpl(String id) { - this(id, null, 0, null); - } - - /** - * Creates a new post. - * - * @param sone - * The Sone this post belongs to - * @param text - * The text of the post - */ - public PostImpl(Sone sone, String text) { - this(sone, System.currentTimeMillis(), text); - } - - /** - * Creates a new post. - * - * @param sone - * The Sone this post belongs to - * @param time - * The time of the post (in milliseconds since Jan 1, 1970 UTC) - * @param text - * The text of the post - */ - public PostImpl(Sone sone, long time, String text) { - this(UUID.randomUUID().toString(), sone, time, text); - } - - /** - * Creates a new post. - * - * @param id - * The ID of the post * @param sone * The Sone this post belongs to + * @param recipient + * The recipient of the post * @param time * The time of the post (in milliseconds since Jan 1, 1970 UTC) * @param text * The text of the post */ - public PostImpl(String id, Sone sone, long time, String text) { + public PostImpl(String id, Sone sone, Sone recipient, long time, String text) { this.id = UUID.fromString(id); this.sone = sone; + this.recipient = recipient; this.time = time; this.text = text; } @@ -124,18 +91,6 @@ public class PostImpl implements Post { } /** - * Sets the Sone of this post. - * - * @param sone - * The Sone of this post - * @return This post (for method chaining) - */ - public PostImpl setSone(Sone sone) { - this.sone = sone; - return this; - } - - /** * {@inheritDoc} */ @Override @@ -144,20 +99,6 @@ public class PostImpl implements Post { } /** - * Sets the recipient of this post. - * - * @param recipient - * The recipient of this post, or {@code null} - * @return This post (for method chaining) - */ - public PostImpl setRecipient(Sone recipient) { - if (!sone.equals(recipient)) { - this.recipient = recipient; - } - return this; - } - - /** * {@inheritDoc} */ @Override @@ -166,18 +107,6 @@ public class PostImpl implements Post { } /** - * Sets the time of this post. - * - * @param time - * The time of this post (in milliseconds since Jan 1, 1970 UTC) - * @return This post (for method chaining) - */ - public PostImpl setTime(long time) { - this.time = time; - return this; - } - - /** * {@inheritDoc} */ @Override @@ -186,18 +115,6 @@ public class PostImpl implements Post { } /** - * Sets the text of this post. - * - * @param text - * The text of this post - * @return This post (for method chaining) - */ - public PostImpl setText(String text) { - this.text = text; - return this; - } - - /** * {@inheritDoc} */ @Override