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=40a62747892740517953dfc85ace7341fcaf019c;hb=dc641a05eda529790ef83b9275db6ce2ac71a04f;hpb=62573c314957b1851f4fbe693b8746686caa940a 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 40a6274..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 @@ -56,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);