From 7dda4a9e722d40766fd29be0957c8928818590d3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Fri, 28 Jun 2019 13:13:38 +0200 Subject: [PATCH] =?utf8?q?=F0=9F=8E=A8=20Replace=20reply=20events=20with?= =?utf8?q?=20Kotlin=20versions?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../sone/core/event/MarkPostReplyKnownEvent.java | 38 ---------------- .../sone/core/event/PostReplyEvent.java | 53 ---------------------- .../net/pterodactylus/sone/web/WebInterface.java | 2 +- .../sone/core/event/MarkPostReplyKnownEvent.kt | 26 +++++++++++ .../sone/core/event/PostReplyEvent.kt | 25 ++++++++++ 5 files changed, 52 insertions(+), 92 deletions(-) delete mode 100644 src/main/java/net/pterodactylus/sone/core/event/MarkPostReplyKnownEvent.java delete mode 100644 src/main/java/net/pterodactylus/sone/core/event/PostReplyEvent.java create mode 100644 src/main/kotlin/net/pterodactylus/sone/core/event/MarkPostReplyKnownEvent.kt create mode 100644 src/main/kotlin/net/pterodactylus/sone/core/event/PostReplyEvent.kt diff --git a/src/main/java/net/pterodactylus/sone/core/event/MarkPostReplyKnownEvent.java b/src/main/java/net/pterodactylus/sone/core/event/MarkPostReplyKnownEvent.java deleted file mode 100644 index 4c0e2fc..0000000 --- a/src/main/java/net/pterodactylus/sone/core/event/MarkPostReplyKnownEvent.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Sone - MarkPostReplyKnownEvent.java - Copyright © 2013–2019 David Roden - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package net.pterodactylus.sone.core.event; - -import net.pterodactylus.sone.data.PostReply; - -/** - * Event that signals that a {@link PostReply} has been marked as - * {@link PostReply#isKnown() known}. - */ -public class MarkPostReplyKnownEvent extends PostReplyEvent { - - /** - * Creates a new “post reply marked known” event. - * - * @param postReply - * The post reply that was marked as known - */ - public MarkPostReplyKnownEvent(PostReply postReply) { - super(postReply); - } - -} diff --git a/src/main/java/net/pterodactylus/sone/core/event/PostReplyEvent.java b/src/main/java/net/pterodactylus/sone/core/event/PostReplyEvent.java deleted file mode 100644 index e31870b..0000000 --- a/src/main/java/net/pterodactylus/sone/core/event/PostReplyEvent.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Sone - PostReplyEvent.java - Copyright © 2013–2019 David Roden - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package net.pterodactylus.sone.core.event; - -import net.pterodactylus.sone.data.PostReply; - -/** - * Base class for {@link PostReply} events. - */ -public class PostReplyEvent { - - /** The post reply the event is about. */ - private final PostReply postReply; - - /** - * Creates a new post reply event. - * - * @param postReply - * The post reply the event is about - */ - protected PostReplyEvent(PostReply postReply) { - this.postReply = postReply; - } - - // - // ACCESSORS - // - - /** - * Returns the post reply the event is about. - * - * @return The post reply the event is about - */ - public PostReply postReply() { - return postReply; - } - -} diff --git a/src/main/java/net/pterodactylus/sone/web/WebInterface.java b/src/main/java/net/pterodactylus/sone/web/WebInterface.java index c78ad53..c50f74e 100644 --- a/src/main/java/net/pterodactylus/sone/web/WebInterface.java +++ b/src/main/java/net/pterodactylus/sone/web/WebInterface.java @@ -844,7 +844,7 @@ public class WebInterface implements SessionProvider { @Subscribe public void markReplyKnown(MarkPostReplyKnownEvent markPostReplyKnownEvent) { - removeReply(markPostReplyKnownEvent.postReply()); + removeReply(markPostReplyKnownEvent.getPostReply()); } @Subscribe diff --git a/src/main/kotlin/net/pterodactylus/sone/core/event/MarkPostReplyKnownEvent.kt b/src/main/kotlin/net/pterodactylus/sone/core/event/MarkPostReplyKnownEvent.kt new file mode 100644 index 0000000..53d208d --- /dev/null +++ b/src/main/kotlin/net/pterodactylus/sone/core/event/MarkPostReplyKnownEvent.kt @@ -0,0 +1,26 @@ +/* + * Sone - MarkPostReplyKnownEvent.kt - Copyright © 2013–2019 David Roden + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.pterodactylus.sone.core.event + +import net.pterodactylus.sone.data.* + +/** + * Event that signals that a [PostReply] has been marked as + * [known][PostReply.isKnown]. + */ +class MarkPostReplyKnownEvent(postReply: PostReply) : PostReplyEvent(postReply) diff --git a/src/main/kotlin/net/pterodactylus/sone/core/event/PostReplyEvent.kt b/src/main/kotlin/net/pterodactylus/sone/core/event/PostReplyEvent.kt new file mode 100644 index 0000000..5096207 --- /dev/null +++ b/src/main/kotlin/net/pterodactylus/sone/core/event/PostReplyEvent.kt @@ -0,0 +1,25 @@ +/* + * Sone - PostReplyEvent.kt - Copyright © 2013–2019 David Roden + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.pterodactylus.sone.core.event + +import net.pterodactylus.sone.data.* + +/** + * Base class for [PostReply] events. + */ +open class PostReplyEvent(val postReply: PostReply) -- 2.7.4