From 449d230fce52aa28f24ed485896cab401b936ff1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 16 Oct 2010 02:26:25 +0200 Subject: [PATCH] Add methods to create a new Reply. --- .../java/net/pterodactylus/sone/core/Core.java | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index 37cbe79..0091265 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -169,6 +169,40 @@ public class Core extends AbstractService { return post; } + /** + * Creates a reply. + * + * @param sone + * The Sone that posts the reply + * @param post + * The post the reply refers to + * @param text + * The text of the reply + * @return The created reply + */ + public Reply createReply(Sone sone, Post post, String text) { + return createReply(sone, post, System.currentTimeMillis(), text); + } + + /** + * Creates a reply. + * + * @param sone + * The Sone that posts the reply + * @param post + * The post the reply refers to + * @param time + * The time of the post + * @param text + * The text of the reply + * @return The created reply + */ + public Reply createReply(Sone sone, Post post, long time, String text) { + Reply reply = getReply(UUID.randomUUID().toString()).setSone(sone).setPost(post).setTime(time).setText(text); + sone.addReply(reply); + return reply; + } + // // ACTIONS // -- 2.7.4