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;
*
* @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;
}
}
/**
- * 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
}
/**
- * 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
}
/**
- * 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
}
/**
- * 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