X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fdata%2Fimpl%2FPostReplyBuilderImpl.java;h=ec1299ae07b25685819cb6ea04aee879c2ec3059;hp=7235bc913ecb5403aae39a6724429af3480b5a88;hb=dc641a05eda529790ef83b9275db6ce2ac71a04f;hpb=191cb539f62259c8e0ac25d0b61546b7a5215f68 diff --git a/src/main/java/net/pterodactylus/sone/data/impl/PostReplyBuilderImpl.java b/src/main/java/net/pterodactylus/sone/data/impl/PostReplyBuilderImpl.java index 7235bc9..ec1299a 100644 --- a/src/main/java/net/pterodactylus/sone/data/impl/PostReplyBuilderImpl.java +++ b/src/main/java/net/pterodactylus/sone/data/impl/PostReplyBuilderImpl.java @@ -1,5 +1,5 @@ /* - * Sone - PostReplyBuilderImpl.java - Copyright © 2013–2016 David Roden + * 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 @@ -29,8 +29,6 @@ import net.pterodactylus.sone.database.SoneProvider; /** * {@link PostReplyBuilder} implementation that creates {@link PostReplyImpl} * objects. - * - * @author David ‘Bombe’ Roden */ public class PostReplyBuilderImpl extends AbstractPostReplyBuilder { @@ -58,11 +56,7 @@ public class PostReplyBuilderImpl extends AbstractPostReplyBuilder { */ @Override public PostReply build() { - checkState((randomId && (id == null)) || (!randomId && (id != null)), "either random ID nor custom ID must be set"); - checkState(senderId != null, "sender must not be null"); - checkState((currentTime && (time == 0)) || (!currentTime && (time >= 0)), "either current time or custom time must be set"); - checkState((text != null) && !text.trim().isEmpty(), "text must not be empty"); - checkState(postId != null, "post must not be null"); + validate(); /* create new post reply. */ return new PostReplyImpl(soneProvider, postProvider, randomId ? UUID.randomUUID().toString() : id, senderId, currentTime ? System.currentTimeMillis() : time, text, postId);