-public class PostBuilderImpl implements PostBuilder {
-
- /** Wether to create a post with a random ID. */
- private boolean randomId;
-
- /** The ID of the post. */
- private String id;
-
- /** The sender of the post. */
- private Sone sender;
-
- /** Whether to use the current time when creating the post. */
- private boolean currentTime;
-
- /** The time of the post. */
- private long time;
-
- /** The text of the post. */
- private String text;
-
- /** The (optional) recipient of the post. */
- private Sone recipient;
-
- /**
- * {@inheritDoc}
- */
- @Override
- public PostBuilder copyPost(Post post) {
- this.randomId = false;
- this.id = post.getId();
- this.sender = post.getSone();
- this.currentTime = false;
- this.time = post.getTime();
- this.text = post.getText();
- this.recipient = post.getRecipient();
- return this;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public PostBuilder randomId() {
- randomId = true;
- return this;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public PostBuilder withId(String id) {
- this.id = id;
- return this;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public PostBuilder from(Sone sender) {
- this.sender = sender;
- return this;
- }