X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fde%2Ftodesbaum%2Fjsite%2Fapplication%2FFileOption.java;h=8509257eb53cb4d76da0ce852494097f73794129;hb=755c2a82abdb528794d1ccc3f342bb3b6d1481a1;hp=4c38286148c9aa60850b0242d0320786cbf7c2ed;hpb=668e00b821dce97504e8afed5038d4266ac67ce9;p=jSite.git diff --git a/src/main/java/de/todesbaum/jsite/application/FileOption.java b/src/main/java/de/todesbaum/jsite/application/FileOption.java index 4c38286..8509257 100644 --- a/src/main/java/de/todesbaum/jsite/application/FileOption.java +++ b/src/main/java/de/todesbaum/jsite/application/FileOption.java @@ -18,10 +18,9 @@ package de.todesbaum.jsite.application; -import static com.google.common.base.Optional.absent; -import static com.google.common.base.Optional.of; +import static java.util.Optional.empty; -import com.google.common.base.Optional; +import java.util.Optional; /** * Container for various file options. @@ -64,7 +63,7 @@ public class FileOption { private String customKey; /** The changed name. */ - private Optional changedName = absent(); + private Optional changedName = empty(); /** The default MIME type. */ private final String defaultMimeType; @@ -86,6 +85,20 @@ public class FileOption { mimeType = defaultMimeType; } + public FileOption(FileOption other) { + this.insert = other.insert; + this.forceInsert = other.forceInsert; + this.insertRedirect = other.insertRedirect; + this.lastInsertHash = other.lastInsertHash; + this.lastInsertEdition = other.lastInsertEdition; + this.lastInsertFilename = other.lastInsertFilename; + this.currentHash = other.currentHash; + this.customKey = other.customKey; + this.changedName = other.changedName; + this.defaultMimeType = other.defaultMimeType; + this.mimeType = other.mimeType; + } + /** * Returns the custom key. The custom key is only used when * {@link #isInsert()} and {@link #isInsertRedirect()} both return {@code @@ -297,7 +310,7 @@ public class FileOption { * The new changed name for this file */ public void setChangedName(String changedName) { - this.changedName = ((changedName != null) && (changedName.length() > 0)) ? of(changedName) : Optional.absent(); + this.changedName = ((changedName != null) && (changedName.length() > 0)) ? Optional.of(changedName) : Optional.empty(); } /**