2 * Sone - AbstractReplyBuilder.java - Copyright © 2013–2020 David Roden
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 package net.pterodactylus.sone.data.impl;
20 import net.pterodactylus.sone.database.ReplyBuilder;
23 * Abstract implementation of a {@link ReplyBuilder}.
26 * The interface implemented and exposed by the builder
28 public class AbstractReplyBuilder<B extends ReplyBuilder<B>> implements ReplyBuilder<B> {
30 /** Whether to use a random ID for the reply. */
31 protected boolean randomId;
33 /** The ID of the reply. */
36 /** The sender of the reply. */
37 protected String senderId;
39 /** Whether to use the current time when creating the reply. */
40 protected boolean currentTime;
42 /** The time of the reply. */
45 /** The text of the reply. */
46 protected String text;
52 @SuppressWarnings("unchecked")
62 @SuppressWarnings("unchecked")
63 public B withId(String id) {
72 @SuppressWarnings("unchecked")
73 public B from(String senderId) {
74 this.senderId = senderId;
82 @SuppressWarnings("unchecked")
83 public B currentTime() {
84 this.currentTime = true;
92 @SuppressWarnings("unchecked")
93 public B withTime(long time) {
102 @SuppressWarnings("unchecked")
103 public B withText(String text) {