X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fdatabase%2FPostBuilder.java;fp=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fdatabase%2FPostBuilder.java;h=0000000000000000000000000000000000000000;hb=4a74200598acbc920892740918d2d2637c80fd1f;hp=45cc06242857c5288030772d7cc30a8dab2a5971;hpb=fafe0029dcbef27ce918fdf7007e78c8705ca20f;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/database/PostBuilder.java b/src/main/java/net/pterodactylus/sone/database/PostBuilder.java deleted file mode 100644 index 45cc062..0000000 --- a/src/main/java/net/pterodactylus/sone/database/PostBuilder.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Sone - PostBuilder.java - Copyright © 2013–2016 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.database; - -import net.pterodactylus.sone.data.Post; -import net.pterodactylus.sone.data.Sone; - -/** - * Builder for {@link Post} objects. - *

- * A {@link Post} consists of the following elements: - *

- * Except for the recipient, all this elements have to be configured on this - * builder. For the ID you have the possibility to configure either a random ID - * (which should be used for new posts) or a custom ID you specify (for creating - * an existing post). For the time you can use the current time (again, for - * creating new posts) or the given time (for loading posts). It is an error to - * specify both ways for either the ID or the time. - * - * @author David ‘Bombe’ Roden - */ -public interface PostBuilder { - - /** - * Copies all attributes of the given post to this post builder. - * - * @param post - * The post whose attributes to copy into this builder - * @return This builder - * @throws NullPointerException - * if {@code post} is {@code null} - */ - public PostBuilder copyPost(Post post) throws NullPointerException; - - /** - * Configures this builder to use the given Sone as sender of the new post. - * - * @param senderId - * The ID of the sender of the post - * @return This post builder - */ - public PostBuilder from(String senderId); - - /** - * Configures this builder to use a random ID for the new post. If this - * method is used, {@link #withId(String)} must not be used. - * - * @return This post builder - */ - public PostBuilder randomId(); - - /** - * Configures this builder to use the given ID as ID for the new post. If - * this method is used, {@link #randomId()} must not be used. - * - * @param id - * The ID to use for the post - * @return This post builder - */ - public PostBuilder withId(String id); - - /** - * Configures this builder to use the current time when creating the post. - * If this method is used, {@link #withTime(long)} must not be used. - * - * @return This post builder - */ - public PostBuilder currentTime(); - - /** - * Configures the builder to use the given time as time for the new post. If - * this method is used, {@link #currentTime()} must not be used. - * - * @param time - * The time to use for the post - * @return This post builder - */ - public PostBuilder withTime(long time); - - /** - * Configures the builder to use the given text for the new post. - * - * @param text - * The text to use for the post - * @return This post builder - */ - public PostBuilder withText(String text); - - /** - * Configures the builder to use the given {@link Sone} as recipient for the - * post. - * - * @param recipientId - * The ID of the recipient of the post - * @return This post builder - */ - public PostBuilder to(String recipientId); - - /** - * Verifies this builder’s configuration and creates a new post. - *

- * The following conditions must be met in order for this builder to be - * configured correctly: - *

- * - * @return A new post - * @throws IllegalStateException - * if this builder’s configuration is not valid - */ - public Post build() throws IllegalStateException; - -}