Class FileList

All Implemented Interfaces:
Cloneable, Iterable<Resource>, ResourceCollection

public class FileList extends DataType implements ResourceCollection
FileList represents an explicitly named list of files. FileLists are useful when you want to capture a list of files regardless of whether they currently exist. By contrast, FileSet operates as a filter, only returning the name of a matched file if it currently exists in the file system.
  • Constructor Details

    • FileList

      public FileList()
      The default constructor.
    • FileList

      protected FileList(FileList filelist)
      A copy constructor.
      Parameters:
      filelist - a FileList value
  • Method Details

    • setRefid

      public void setRefid(Reference r) throws BuildException
      Makes this instance in effect a reference to another FileList instance.

      You must not set another attribute or nest elements inside this element if you make it a reference.

      Overrides:
      setRefid in class DataType
      Parameters:
      r - the reference to another filelist.
      Throws:
      BuildException - if an error occurs.
    • setDir

      public void setDir(File dir) throws BuildException
      Set the dir attribute.
      Parameters:
      dir - the directory this filelist is relative to.
      Throws:
      BuildException - if an error occurs
    • getDir

      public File getDir(Project p)
      Parameters:
      p - the current project
      Returns:
      the directory attribute
    • setFiles

      public void setFiles(String filenames)
      Set the filenames attribute.
      Parameters:
      filenames - a string containing filenames, separated by comma or by whitespace.
    • getFiles

      public String[] getFiles(Project p)
      Returns the list of files represented by this FileList.
      Parameters:
      p - the current project
      Returns:
      the list of files represented by this FileList.
    • addConfiguredFile

      public void addConfiguredFile(FileList.FileName name)
      Add a nested <file> nested element.
      Parameters:
      name - a configured file element with a name.
      Since:
      Ant 1.6.2
    • iterator

      public Iterator<Resource> iterator()
      Fulfill the ResourceCollection contract.
      Specified by:
      iterator in interface Iterable<Resource>
      Returns:
      an Iterator of Resources.
      Since:
      Ant 1.7
    • size

      public int size()
      Fulfill the ResourceCollection contract.
      Specified by:
      size in interface ResourceCollection
      Returns:
      number of elements as int.
      Since:
      Ant 1.7
    • isFilesystemOnly

      public boolean isFilesystemOnly()
      Always returns true.
      Specified by:
      isFilesystemOnly in interface ResourceCollection
      Returns:
      true indicating that all elements will be FileResources.
      Since:
      Ant 1.7