From 05a9625d529ef49111427c6a46510fa0dca057d8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Mon, 25 Feb 2019 06:40:31 +0100 Subject: [PATCH] Remove more unused classes --- .../data/impl/DefaultPostReplyBuilderFactory.java | 60 -------- .../sone/data/impl/PostReplyBuilderImpl.java | 65 --------- .../sone/data/impl/PostReplyImpl.java | 84 ----------- .../pterodactylus/sone/data/impl/ReplyImpl.java | 154 --------------------- 4 files changed, 363 deletions(-) delete mode 100644 src/main/java/net/pterodactylus/sone/data/impl/DefaultPostReplyBuilderFactory.java delete mode 100644 src/main/java/net/pterodactylus/sone/data/impl/PostReplyBuilderImpl.java delete mode 100644 src/main/java/net/pterodactylus/sone/data/impl/PostReplyImpl.java delete mode 100644 src/main/java/net/pterodactylus/sone/data/impl/ReplyImpl.java diff --git a/src/main/java/net/pterodactylus/sone/data/impl/DefaultPostReplyBuilderFactory.java b/src/main/java/net/pterodactylus/sone/data/impl/DefaultPostReplyBuilderFactory.java deleted file mode 100644 index 8080f41..0000000 --- a/src/main/java/net/pterodactylus/sone/data/impl/DefaultPostReplyBuilderFactory.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Sone - DefaultPostReplyBuilderFactory.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.data.impl; - -import net.pterodactylus.sone.database.PostProvider; -import net.pterodactylus.sone.database.PostReplyBuilder; -import net.pterodactylus.sone.database.PostReplyBuilderFactory; -import net.pterodactylus.sone.database.SoneProvider; - -import com.google.inject.Inject; - -/** - * {@link PostReplyBuilderFactory} that creates {@link PostReplyBuilderImpl}s. - */ -public class DefaultPostReplyBuilderFactory implements PostReplyBuilderFactory { - - /** The Sone provider. */ - private final SoneProvider soneProvider; - - /** The post provider. */ - private final PostProvider postProvider; - - /** - * Creates a new default post reply builder factory. - * - * @param soneProvider - * The Sone provider - * @param postProvider - * The post provider - */ - @Inject - public DefaultPostReplyBuilderFactory(SoneProvider soneProvider, PostProvider postProvider) { - this.soneProvider = soneProvider; - this.postProvider = postProvider; - } - - /** - * {@inheritDoc} - */ - @Override - public PostReplyBuilder newPostReplyBuilder() { - return new PostReplyBuilderImpl(soneProvider, postProvider); - } - -} diff --git a/src/main/java/net/pterodactylus/sone/data/impl/PostReplyBuilderImpl.java b/src/main/java/net/pterodactylus/sone/data/impl/PostReplyBuilderImpl.java deleted file mode 100644 index ec1299a..0000000 --- a/src/main/java/net/pterodactylus/sone/data/impl/PostReplyBuilderImpl.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Sone - PostReplyBuilderImpl.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.data.impl; - -import static com.google.common.base.Preconditions.checkState; - -import java.util.UUID; - -import net.pterodactylus.sone.data.PostReply; -import net.pterodactylus.sone.database.PostProvider; -import net.pterodactylus.sone.database.PostReplyBuilder; -import net.pterodactylus.sone.database.SoneProvider; - -/** - * {@link PostReplyBuilder} implementation that creates {@link PostReplyImpl} - * objects. - */ -public class PostReplyBuilderImpl extends AbstractPostReplyBuilder { - - /** The Sone provider. */ - private final SoneProvider soneProvider; - - /** The post provider. */ - private final PostProvider postProvider; - - /** - * Creates a new post reply builder. - * - * @param soneProvider - * The Sone provider - * @param postProvider - * The post provider - */ - public PostReplyBuilderImpl(SoneProvider soneProvider, PostProvider postProvider) { - this.soneProvider = soneProvider; - this.postProvider = postProvider; - } - - /** - * {@inheritDoc} - */ - @Override - public PostReply build() { - validate(); - - /* create new post reply. */ - return new PostReplyImpl(soneProvider, postProvider, randomId ? UUID.randomUUID().toString() : id, senderId, currentTime ? System.currentTimeMillis() : time, text, postId); - } - -} diff --git a/src/main/java/net/pterodactylus/sone/data/impl/PostReplyImpl.java b/src/main/java/net/pterodactylus/sone/data/impl/PostReplyImpl.java deleted file mode 100644 index 33b00ff..0000000 --- a/src/main/java/net/pterodactylus/sone/data/impl/PostReplyImpl.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Sone - PostReplyImpl.java - Copyright © 2010–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.data.impl; - -import static com.google.common.base.Optional.fromNullable; - -import net.pterodactylus.sone.data.Post; -import net.pterodactylus.sone.data.PostReply; -import net.pterodactylus.sone.database.PostProvider; -import net.pterodactylus.sone.database.SoneProvider; - -import com.google.common.base.Optional; - -/** - * Simple {@link PostReply} implementation. - */ -public class PostReplyImpl extends ReplyImpl implements PostReply { - - /** The post provider. */ - private final PostProvider postProvider; - - /** The Post this reply refers to. */ - private final String postId; - - /** - * Creates a new reply. - * - * @param soneProvider - * The Sone provider - * @param postProvider - * The post provider - * @param id - * The ID of the reply - * @param soneId - * The ID of the Sone of the reply - * @param time - * The time of the reply - * @param text - * The text of the reply - * @param postId - * The ID of the post this reply refers to - */ - public PostReplyImpl(SoneProvider soneProvider, PostProvider postProvider, String id, String soneId, long time, String text, String postId) { - super(soneProvider, id, soneId, time, text); - this.postProvider = postProvider; - this.postId = postId; - } - - // - // ACCESSORS - // - - /** - * {@inheritDocs} - */ - @Override - public String getPostId() { - return postId; - } - - /** - * {@inheritDoc} - */ - @Override - public Optional getPost() { - return fromNullable(postProvider.getPost(postId)); - } - -} diff --git a/src/main/java/net/pterodactylus/sone/data/impl/ReplyImpl.java b/src/main/java/net/pterodactylus/sone/data/impl/ReplyImpl.java deleted file mode 100644 index 40d66db..0000000 --- a/src/main/java/net/pterodactylus/sone/data/impl/ReplyImpl.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Sone - ReplyImpl.java - Copyright © 2011–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.data.impl; - -import net.pterodactylus.sone.data.Reply; -import net.pterodactylus.sone.data.Sone; -import net.pterodactylus.sone.database.SoneProvider; - -/** - * Abstract base class for all replies. - * - * @param - * The type of the reply - */ -public abstract class ReplyImpl> implements Reply { - - /** The Sone provider. */ - private final SoneProvider soneProvider; - - /** The ID of the reply. */ - private final String id; - - /** The Sone that created this reply. */ - private final String soneId; - - /** The time of the reply. */ - private final long time; - - /** The text of the reply. */ - private final String text; - - /** Whether the reply is known. */ - private volatile boolean known; - - /** - * Creates a new reply. - * - * @param soneProvider - * The Sone provider - * @param id - * The ID of the reply - * @param soneId - * The ID of the Sone of the reply - * @param time - * The time of the reply - * @param text - * The text of the reply - */ - protected ReplyImpl(SoneProvider soneProvider, String id, String soneId, long time, String text) { - this.soneProvider = soneProvider; - this.id = id; - this.soneId = soneId; - this.time = time; - this.text = text; - } - - /** - * {@inheritDoc} - */ - @Override - public String getId() { - return id; - } - - /** - * {@inheritDoc} - */ - @Override - public Sone getSone() { - return soneProvider.getSone(soneId); - } - - /** - * {@inheritDoc} - */ - @Override - public long getTime() { - return time; - } - - /** - * {@inheritDoc} - */ - @Override - public String getText() { - return text; - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isKnown() { - return known; - } - - /** - * {@inheritDoc} - */ - @Override - @SuppressWarnings("unchecked") - public T setKnown(boolean known) { - this.known = known; - return (T) this; - } - - // - // OBJECT METHODS - // - - /** - * {@inheritDoc} - */ - @Override - public int hashCode() { - return id.hashCode(); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean equals(Object object) { - if (!(object instanceof Reply)) { - return false; - } - Reply reply = (Reply) object; - return reply.getId().equals(id); - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return String.format("%s[id=%s,sone=%s,time=%d,text=%s]", getClass().getName(), id, soneId, time, text); - } - -} -- 2.7.4