add isEmpty()
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Mon, 2 Jun 2008 06:42:58 +0000 (08:42 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Mon, 2 Jun 2008 06:42:58 +0000 (08:42 +0200)
src/net/pterodactylus/jsite/project/FileOverride.java

index be11887..94bde40 100644 (file)
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
+
 package net.pterodactylus.jsite.project;
 
 /**
  * An override is used to enter other information about a file than the defaults
  * would have yielded. It is also used to add redirects to a project.
 package net.pterodactylus.jsite.project;
 
 /**
  * An override is used to enter other information about a file than the defaults
  * would have yielded. It is also used to add redirects to a project.
- *
+ * 
  * @author David ‘Bombe’ Roden &lt;bombe@freenetproject.org&gt;
  * @version $Id$
  */
  * @author David ‘Bombe’ Roden &lt;bombe@freenetproject.org&gt;
  * @version $Id$
  */
@@ -37,8 +38,18 @@ public class FileOverride {
        private String redirectTarget;
 
        /**
        private String redirectTarget;
 
        /**
+        * Checks whether this override has any content.
+        * 
+        * @return <code>true</code> if this override does not have any effects,
+        *         <code>false</code> otherwise
+        */
+       public boolean isEmpty() {
+               return (insert == null) && (contentType == null) && (redirectTarget == null);
+       }
+
+       /**
         * Returns the insert override.
         * Returns the insert override.
-        *
+        * 
         * @return <code>true</code> if the entry should be inserted,
         *         <code>false</code> if it should not be inserted,
         *         <code>null</code> if the default should not be overridden
         * @return <code>true</code> if the entry should be inserted,
         *         <code>false</code> if it should not be inserted,
         *         <code>null</code> if the default should not be overridden
@@ -49,7 +60,7 @@ public class FileOverride {
 
        /**
         * Sets the insert override.
 
        /**
         * Sets the insert override.
-        *
+        * 
         * @param insert
         *            <code>true</code> if the entry should be inserted,
         *            <code>false</code> if it should not be inserted,
         * @param insert
         *            <code>true</code> if the entry should be inserted,
         *            <code>false</code> if it should not be inserted,
@@ -61,7 +72,7 @@ public class FileOverride {
 
        /**
         * Returns the override content type.
 
        /**
         * Returns the override content type.
-        *
+        * 
         * @return The override content type, or <code>null</code> to not override
         *         the default
         */
         * @return The override content type, or <code>null</code> to not override
         *         the default
         */
@@ -71,7 +82,7 @@ public class FileOverride {
 
        /**
         * Sets the override content type.
 
        /**
         * Sets the override content type.
-        *
+        * 
         * @param contentType
         *            The override content type, or <code>null</code> to not
         *            override the default
         * @param contentType
         *            The override content type, or <code>null</code> to not
         *            override the default
@@ -82,7 +93,7 @@ public class FileOverride {
 
        /**
         * Returns the target of a redirect.
 
        /**
         * Returns the target of a redirect.
-        *
+        * 
         * @return The target URI of the redirect, or <code>null</code> if no
         *         redirect should be created
         */
         * @return The target URI of the redirect, or <code>null</code> if no
         *         redirect should be created
         */
@@ -92,7 +103,7 @@ public class FileOverride {
 
        /**
         * Sets the target of a redirect.
 
        /**
         * Sets the target of a redirect.
-        *
+        * 
         * @param redirectTarget
         *            The target URI of the redirect, or <code>null</code> if no
         *            redirect should be created
         * @param redirectTarget
         *            The target URI of the redirect, or <code>null</code> if no
         *            redirect should be created
@@ -112,7 +123,7 @@ public class FileOverride {
        /**
         * Converts an override string created by {@link #toString()} back to an
         * {@link FileOverride} object.
        /**
         * Converts an override string created by {@link #toString()} back to an
         * {@link FileOverride} object.
-        *
+        * 
         * @param overrideString
         *            The textual representation of the override
         * @return The parsed override, or <code>null</code> if the string could
         * @param overrideString
         *            The textual representation of the override
         * @return The parsed override, or <code>null</code> if the string could