ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r290806 - /ant/core/trunk/src/main/org/apache/tools/ant/types/resources/selectors/Type.java
Date Wed, 21 Sep 2005 19:48:35 GMT
Author: mbenson
Date: Wed Sep 21 12:48:31 2005
New Revision: 290806

URL: http://svn.apache.org/viewcvs?rev=290806&view=rev
Log:
convenience additions

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/types/resources/selectors/Type.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/resources/selectors/Type.java
URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/main/org/apache/tools/ant/types/resources/selectors/Type.java?rev=290806&r1=290805&r2=290806&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/resources/selectors/Type.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/resources/selectors/Type.java Wed Sep
21 12:48:31 2005
@@ -26,11 +26,34 @@
  */
 public class Type implements ResourceSelector {
 
+    private static final String FILE_ATTR = "file";
+    private static final String DIR_ATTR = "dir";
+
+    /** Static file type selector. */
+    public static final Type FILE = new Type(new FileDir(FILE_ATTR));
+
+    /** Static dir type selector. */
+    public static final Type DIR = new Type(new FileDir(DIR_ATTR));
+
     /**
      * Implements the type attribute.
      */
     public static class FileDir extends EnumeratedAttribute {
-        private static final String[] VALUES = new String[] {"file", "dir"};
+        private static final String[] VALUES = new String[] {FILE_ATTR, DIR_ATTR};
+
+        /**
+         * Default constructor.
+         */
+        public FileDir() {
+        }
+
+        /**
+         * Convenience constructor.
+         * @param value the String EnumeratedAttribute value.
+         */
+        public FileDir(String value) {
+            setValue(value);
+        }
 
         /**
          * Return the possible values.
@@ -42,6 +65,20 @@
     }
 
     private FileDir type = null;
+
+    /**
+     * Default constructor.
+     */
+    public Type() {
+    }
+
+    /**
+     * Convenience constructor.
+     * @param fd the FileDir type.
+     */
+    public Type(FileDir fd) {
+        setType(fd);
+    }
 
     /**
      * Set type; file|dir.



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message