Browse Source

convenience additions

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@290806 13f79535-47bb-0310-9956-ffa450edef68
master
Matthew Jason Benson 20 years ago
parent
commit
9822ff73cb
1 changed files with 38 additions and 1 deletions
  1. +38
    -1
      src/main/org/apache/tools/ant/types/resources/selectors/Type.java

+ 38
- 1
src/main/org/apache/tools/ant/types/resources/selectors/Type.java View File

@@ -26,11 +26,34 @@ import org.apache.tools.ant.types.EnumeratedAttribute;
*/
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.
@@ -43,6 +66,20 @@ public class Type implements ResourceSelector {

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.
* @param fd a FileDir object.


Loading…
Cancel
Save