🔀 Merge branch 'release/v82'
[Sone.git] / src / main / java / net / pterodactylus / sone / data / TemporaryImage.java
index 5e7c78d..b76c3cd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Sone - TemporaryImage.java - Copyright Â© 2011–2012 David Roden
+ * Sone - TemporaryImage.java - Copyright Â© 2011–2020 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
 
 package net.pterodactylus.sone.data;
 
-import java.util.UUID;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Preconditions.checkState;
 
-import net.pterodactylus.util.validation.Validation;
+import java.util.UUID;
 
 /**
  * A temporary image stores an uploaded image in memory until it has been
  * inserted into Freenet and is subsequently loaded from there.
- *
- * @author <a href="mailto:bombe@pterodactylus.net">David â€˜Bombe’ Roden</a>
  */
 public class TemporaryImage {
 
@@ -82,7 +81,8 @@ public class TemporaryImage {
         * @return This temporary image
         */
        public TemporaryImage setMimeType(String mimeType) {
-               Validation.begin().isNotNull("MIME Type", mimeType).isNull("Previous MIME Type", this.mimeType).check();
+               checkNotNull(mimeType, "mimeType must not be null");
+               checkState(this.mimeType == null, "mime type must not already be set");
                this.mimeType = mimeType;
                return this;
        }
@@ -105,7 +105,8 @@ public class TemporaryImage {
         * @return This temporary image
         */
        public TemporaryImage setImageData(byte[] imageData) {
-               Validation.begin().isNotNull("Image Data", imageData).isNull("Previous Image Data", this.imageData).check();
+               checkNotNull(imageData, "imageData must not be null");
+               checkState(this.imageData == null, "image data must not already be set");
                this.imageData = imageData;
                return this;
        }