2 * Sone - ReplyShell.java - Copyright © 2010 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;
20 import java.util.UUID;
23 * A shell around a {@link Reply} for replies that have not yet been retrieved
26 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
28 public class ReplyShell extends Reply implements Shell<Reply> {
30 /** The shell creator. */
31 public static final ShellCreator<Reply> creator = new ShellCreator<Reply>() {
34 public Shell<Reply> createShell(String id) {
35 return new ReplyShell().setId(UUID.fromString(id));
39 /** The Sone that posted this reply. */
42 /** The ID of the reply. */
45 /** The Post this reply refers to. */
48 /** The time of the reply. */
51 /** The text of the reply. */
55 * Creates a new reply shell.
58 super(null, null, null);
66 * Returns the Sone that posted this reply.
68 * @return The Sone that posted this reply
71 public Sone getSone() {
76 * Sets the Sone that posted this reply.
79 * The sone that pasted this reply
80 * @return This reply shell (for method chaining)
82 public ReplyShell setSone(Sone sone) {
88 * Returns the ID of the reply.
90 * @return The ID of the reply
93 public String getId() {
98 * Sets the ID of this reply.
101 * The ID of this reply
102 * @return This reply shell (for method chaining)
104 public ReplyShell setId(UUID id) {
110 * Returns the post this reply refers to.
112 * @return The post this reply refers to
115 public Post getPost() {
120 * Sets the post this reply refers to.
123 * The post this reply refers to
124 * @return This reply shell (for method chaining)
126 public ReplyShell setPost(Post post) {
132 * Returns the time of the reply.
134 * @return The time of the reply (in milliseconds since Jan 1, 1970 UTC)
137 public long getTime() {
142 * Sets the time of this reply.
145 * The time of this reply (in milliseconds since Jan 1, 1970 UTC)
146 * @return This reply shell (for method chaining)
148 public ReplyShell setTime(long time) {
154 * Returns the text of the reply.
156 * @return The text of the reply
159 public String getText() {
164 * Sets the text of the reply.
167 * The text of the reply
168 * @return This reply shell (for method chaining)
170 public ReplyShell setText(String text) {
183 public boolean canUnshell() {
184 return (sone != null) && (!(sone instanceof Shell<?>)) && (id != null) && (post != null) && (!(post instanceof Shell<?>)) && (time != null) && (text != null);
191 public Reply getShelled() {
193 return new Reply(sone, id, post, time, text);