📄 Update year in copyright line
[jSite.git] / src / main / java / de / todesbaum / jsite / application / FileOption.java
index aa28b54..500206e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * jSite - FileOption.java - Copyright Â© 2006–2012 David Roden
+ * jSite - FileOption.java - Copyright Â© 2006–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 the Free Software
 
 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<String> changedName = absent();
+       private Optional<String> 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.<String>absent();
+               this.changedName = ((changedName != null) && (changedName.length() > 0)) ? Optional.of(changedName) : Optional.<String>empty();
        }
 
        /**