AbstractFileSet (Apache Ant API)
Date: 2016-04-24

org.apache.tools.ant.types

## Class AbstractFileSet

- java.lang.Object
- - org.apache.tools.ant.ProjectComponent
  - - org.apache.tools.ant.types.DataType
    - - org.apache.tools.ant.types.AbstractFileSet

- All Implemented Interfaces:
    java.lang.Cloneable, SelectorContainer
  Direct Known Subclasses:
    DirSet, FileSet, MultiRootFileSet, Sync.SyncTarget

      public abstract class AbstractFileSet
      extends DataType
      implements java.lang.Cloneable, SelectorContainer

  Class that holds an implicit patternset and supports nested patternsets and creates a DirectoryScanner using these patterns.

  Common base class for DirSet and FileSet.

- - ### Field Summary

    - ### Fields inherited from class org.apache.tools.ant.types.DataType

      `checked, ref`

    - ### Fields inherited from class org.apache.tools.ant.ProjectComponent

      `description, location, project`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `` | `AbstractFileSet()` Construct a new `AbstractFileSet`.
    `protected` | `AbstractFileSet(AbstractFileSet fileset)` Construct a new `AbstractFileSet`, shallowly cloned from the specified `AbstractFileSet`.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(FileSelector selector)` Add an arbitrary selector.
    `void` | `addAnd(AndSelector selector)` Add an "And" selector entry on the selector list.
    `void` | `addContains(ContainsSelector selector)` Add a contains selector entry on the selector list.
    `void` | `addContainsRegexp(ContainsRegexpSelector selector)` Add a regular expression selector entry on the selector list.
    `void` | `addCustom(ExtendSelector selector)` Add an extended selector entry on the selector list.
    `void` | `addDate(DateSelector selector)` Add a selector date entry on the selector list.
    `void` | `addDepend(DependSelector selector)` Add a depends selector entry on the selector list.
    `void` | `addDepth(DepthSelector selector)` Add a depth selector entry on the selector list.
    `void` | `addDifferent(DifferentSelector selector)` Add a DifferentSelector entry on the selector list.
    `void` | `addFilename(FilenameSelector selector)` Add a selector filename entry on the selector list.
    `void` | `addMajority(MajoritySelector selector)` Add a majority selector entry on the selector list.
    `void` | `addModified(ModifiedSelector selector)` Add the modified selector.
    `void` | `addNone(NoneSelector selector)` Add a "None" selector entry on the selector list.
    `void` | `addNot(NotSelector selector)` Add a "Not" selector entry on the selector list.
    `void` | `addOr(OrSelector selector)` Add an "Or" selector entry on the selector list.
    `void` | `addPresent(PresentSelector selector)` Add a present selector entry on the selector list.
    `void` | `addReadable(ReadableSelector r)`
    `void` | `addSelector(SelectSelector selector)` Add a "Select" selector entry on the selector list.
    `void` | `addSize(SizeSelector selector)` Add a selector size entry on the selector list.
    `void` | `addType(TypeSelector selector)` Add a selector type entry on the selector list.
    `void` | `addWritable(WritableSelector w)`
    `void` | `appendExcludes(java.lang.String[] excludes)` Appends `excludes` to the current list of include patterns.
    `void` | `appendIncludes(java.lang.String[] includes)` Appends `includes` to the current list of include patterns.
    `void` | `appendSelector(FileSelector selector)` Add a new selector into this container.
    `java.lang.Object` | `clone()` Creates a deep clone of this instance, except for the nested selectors (the list of selectors is a shallow clone of this instance's list).
    `PatternSet.NameEntry` | `createExclude()` Add a name entry to the exclude list.
    `PatternSet.NameEntry` | `createExcludesFile()` Add a name entry to the excludes files list.
    `PatternSet.NameEntry` | `createInclude()` Add a name entry to the include list.
    `PatternSet.NameEntry` | `createIncludesFile()` Add a name entry to the include files list.
    `PatternSet` | `createPatternSet()` Creates a nested patternset.
    `protected void` | `dieOnCircularReference(java.util.Stack<java.lang.Object> stk, Project p)` Check to see whether any DataType we hold references to is included in the Stack (which holds all DataType instances that directly or indirectly reference this instance, including this instance itself).
    `boolean` | `getDefaultexcludes()` Whether default exclusions should be used or not.
    `java.io.File` | `getDir()` Retrieves the base-directory for this instance.
    `java.io.File` | `getDir(Project p)` Retrieves the base-directory for this instance.
    `DirectoryScanner` | `getDirectoryScanner()` Returns the directory scanner needed to access the files to process.
    `DirectoryScanner` | `getDirectoryScanner(Project p)` Returns the directory scanner needed to access the files to process.
    `boolean` | `getErrorOnMissingDir()` Gets whether an error is/should be thrown if the base directory does not exist.
    `int` | `getMaxLevelsOfSymlinks()` The maximum number of times a symbolic link may be followed during a scan.
    `protected AbstractFileSet` | `getRef(Project p)` Performs the check for circular references and returns the referenced FileSet.
    `FileSelector[]` | `getSelectors(Project p)` Returns the set of selectors as an array.
    `boolean` | `hasPatterns()` Indicates whether there are any patterns here.
    `boolean` | `hasSelectors()` Indicates whether there are any selectors here.
    `boolean` | `isCaseSensitive()` Find out if the fileset is case sensitive.
    `boolean` | `isFollowSymlinks()` Find out if the fileset wants to follow symbolic links.
    `java.lang.String[]` | `mergeExcludes(Project p)` Get the merged exclude patterns for this AbstractFileSet.
    `java.lang.String[]` | `mergeIncludes(Project p)` Get the merged include patterns for this AbstractFileSet.
    `PatternSet` | `mergePatterns(Project p)` Get the merged patterns for this AbstractFileSet.
    `int` | `selectorCount()` Gives the count of the number of selectors in this container.
    `java.util.Enumeration<FileSelector>` | `selectorElements()` Returns an enumerator for accessing the set of selectors.
    `void` | `setCaseSensitive(boolean caseSensitive)` Sets case sensitivity of the file system.
    `void` | `setDefaultexcludes(boolean useDefaultExcludes)` Sets whether default exclusions should be used or not.
    `void` | `setDir(java.io.File dir)` Sets the base-directory for this instance.
    `void` | `setErrorOnMissingDir(boolean errorOnMissingDir)` Sets whether an error is thrown if a directory does not exist.
    `void` | `setExcludes(java.lang.String excludes)` Appends `excludes` to the current list of exclude patterns.
    `void` | `setExcludesfile(java.io.File excl)` Sets the `File` containing the excludes patterns.
    `void` | `setFile(java.io.File file)` Creates a single file fileset.
    `void` | `setFollowSymlinks(boolean followSymlinks)` Sets whether or not symbolic links should be followed.
    `void` | `setIncludes(java.lang.String includes)` Appends `includes` to the current list of include patterns.
    `void` | `setIncludesfile(java.io.File incl)` Sets the `File` containing the includes patterns.
    `void` | `setMaxLevelsOfSymlinks(int max)` The maximum number of times a symbolic link may be followed during a scan.
    `void` | `setRefid(Reference r)` Makes this instance in effect a reference to another instance.
    `void` | `setupDirectoryScanner(FileScanner ds)` Set up the specified directory scanner against this AbstractFileSet's Project.
    `void` | `setupDirectoryScanner(FileScanner ds, Project p)` Set up the specified directory scanner against the specified project.
    `java.lang.String` | `toString()` Returns included files as a list of semicolon-separated filenames.

    - ### Methods inherited from class org.apache.tools.ant.types.DataType

      `checkAttributesAllowed, checkChildrenAllowed, circularReference, dieOnCircularReference, dieOnCircularReference, getCheckedRef, getCheckedRef, getCheckedRef, getCheckedRef, getDataTypeName, getRefid, invokeCircularReferenceCheck, isChecked, isReference, noChildrenAllowed, pushAndInvokeCircularReferenceCheck, setChecked, tooManyAttributes`

    - ### Methods inherited from class org.apache.tools.ant.ProjectComponent

      `getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject`

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### AbstractFileSet

          public AbstractFileSet()

      Construct a new `AbstractFileSet`.

    - #### AbstractFileSet

          protected AbstractFileSet(AbstractFileSet fileset)

      Construct a new `AbstractFileSet`, shallowly cloned from the specified `AbstractFileSet`.
      Parameters:
        `fileset` - the `AbstractFileSet` to use as a template.

  - ### Method Detail

    - #### setRefid

          public void setRefid(Reference r)
                        throws BuildException

      Makes this instance in effect a reference to another 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 use.
      Throws:
        `BuildException` - on error

    - #### setDir

          public void setDir(java.io.File dir)
                      throws BuildException

      Sets the base-directory for this instance.
      Parameters:
        `dir` - the directory's `File` instance.
      Throws:
        `BuildException` - on error

    - #### getDir

          public java.io.File getDir()

      Retrieves the base-directory for this instance.
      Returns:
        `File`.

    - #### getDir

          public java.io.File getDir(Project p)

      Retrieves the base-directory for this instance.
      Parameters:
        `p` - the `Project` against which the reference is resolved, if set.
      Returns:
        `File`.

    - #### createPatternSet

          public PatternSet createPatternSet()

      Creates a nested patternset.
      Returns:
        `PatternSet`.

    - #### createInclude

          public PatternSet.NameEntry createInclude()

      Add a name entry to the include list.
      Returns:
        `PatternSet.NameEntry`.

    - #### createIncludesFile

          public PatternSet.NameEntry createIncludesFile()

      Add a name entry to the include files list.
      Returns:
        `PatternSet.NameEntry`.

    - #### createExclude

          public PatternSet.NameEntry createExclude()

      Add a name entry to the exclude list.
      Returns:
        `PatternSet.NameEntry`.

    - #### createExcludesFile

          public PatternSet.NameEntry createExcludesFile()

      Add a name entry to the excludes files list.
      Returns:
        `PatternSet.NameEntry`.

    - #### setFile

          public void setFile(java.io.File file)

      Creates a single file fileset.
      Parameters:
        `file` - the single `File` included in this `AbstractFileSet`.

    - #### setIncludes

          public void setIncludes(java.lang.String includes)

      Appends `includes` to the current list of include patterns.

      Patterns may be separated by a comma or a space.

      Parameters:
        `includes` - the `String` containing the include patterns.

    - #### appendIncludes

          public void appendIncludes(java.lang.String[] includes)

      Appends `includes` to the current list of include patterns.
      Parameters:
        `includes` - array containing the include patterns.
      Since:
        Ant 1.7

    - #### setExcludes

          public void setExcludes(java.lang.String excludes)

      Appends `excludes` to the current list of exclude patterns.

      Patterns may be separated by a comma or a space.

      Parameters:
        `excludes` - the `String` containing the exclude patterns.

    - #### appendExcludes

          public void appendExcludes(java.lang.String[] excludes)

      Appends `excludes` to the current list of include patterns.
      Parameters:
        `excludes` - array containing the exclude patterns.
      Since:
        Ant 1.7

    - #### setIncludesfile

          public void setIncludesfile(java.io.File incl)
                               throws BuildException

      Sets the `File` containing the includes patterns.
      Parameters:
        `incl` - `File` instance.
      Throws:
        `BuildException` - on error

    - #### setExcludesfile

          public void setExcludesfile(java.io.File excl)
                               throws BuildException

      Sets the `File` containing the excludes patterns.
      Parameters:
        `excl` - `File` instance.
      Throws:
        `BuildException` - on error

    - #### setDefaultexcludes

          public void setDefaultexcludes(boolean useDefaultExcludes)

      Sets whether default exclusions should be used or not.
      Parameters:
        `useDefaultExcludes` - `boolean`.

    - #### getDefaultexcludes

          public boolean getDefaultexcludes()

      Whether default exclusions should be used or not.
      Returns:
        the default exclusions value.
      Since:
        Ant 1.6.3

    - #### setCaseSensitive

          public void setCaseSensitive(boolean caseSensitive)

      Sets case sensitivity of the file system.
      Parameters:
        `caseSensitive` - `boolean`.

    - #### isCaseSensitive

          public boolean isCaseSensitive()

      Find out if the fileset is case sensitive.
      Returns:
        `boolean` indicating whether the fileset is case sensitive.
      Since:
        Ant 1.7

    - #### setFollowSymlinks

          public void setFollowSymlinks(boolean followSymlinks)

      Sets whether or not symbolic links should be followed.
      Parameters:
        `followSymlinks` - whether or not symbolic links should be followed.

    - #### isFollowSymlinks

          public boolean isFollowSymlinks()

      Find out if the fileset wants to follow symbolic links.
      Returns:
        `boolean` indicating whether symbolic links should be followed.
      Since:
        Ant 1.6

    - #### setMaxLevelsOfSymlinks

          public void setMaxLevelsOfSymlinks(int max)

      The maximum number of times a symbolic link may be followed during a scan.
      Since:
        Ant 1.8.0

    - #### getMaxLevelsOfSymlinks

          public int getMaxLevelsOfSymlinks()

      The maximum number of times a symbolic link may be followed during a scan.
      Since:
        Ant 1.8.0

    - #### setErrorOnMissingDir

          public void setErrorOnMissingDir(boolean errorOnMissingDir)

      Sets whether an error is thrown if a directory does not exist.
      Parameters:
        `errorOnMissingDir` - true if missing directories cause errors, false if not.

    - #### getErrorOnMissingDir

          public boolean getErrorOnMissingDir()

      Gets whether an error is/should be thrown if the base directory does not exist.
      Since:
        Ant 1.8.2

    - #### getDirectoryScanner

          public DirectoryScanner getDirectoryScanner()

      Returns the directory scanner needed to access the files to process.
      Returns:
        a `DirectoryScanner` instance.

    - #### getDirectoryScanner

          public DirectoryScanner getDirectoryScanner(Project p)

      Returns the directory scanner needed to access the files to process.
      Parameters:
        `p` - the Project against which the DirectoryScanner should be configured.
      Returns:
        a `DirectoryScanner` instance.

    - #### setupDirectoryScanner

          public void setupDirectoryScanner(FileScanner ds)

      Set up the specified directory scanner against this AbstractFileSet's Project.
      Parameters:
        `ds` - a `FileScanner` instance.

    - #### setupDirectoryScanner

          public void setupDirectoryScanner(FileScanner ds,
                                   Project p)

      Set up the specified directory scanner against the specified project.
      Parameters:
        `ds` - a `FileScanner` instance.
        `p` - an Ant `Project` instance.

    - #### getRef

          protected AbstractFileSet getRef(Project p)

      Performs the check for circular references and returns the referenced FileSet.
      Parameters:
        `p` - the current project
      Returns:
        the referenced FileSet

    - #### hasSelectors

          public boolean hasSelectors()

      Indicates whether there are any selectors here.
      Specified by:
        `hasSelectors` in interface `SelectorContainer`
      Returns:
        whether any selectors are in this container.

    - #### hasPatterns

          public boolean hasPatterns()

      Indicates whether there are any patterns here.
      Returns:
        whether any patterns are in this container.

    - #### selectorCount

          public int selectorCount()

      Gives the count of the number of selectors in this container.
      Specified by:
        `selectorCount` in interface `SelectorContainer`
      Returns:
        the number of selectors in this container as an `int`.

    - #### getSelectors

          public FileSelector[] getSelectors(Project p)

      Returns the set of selectors as an array.
      Specified by:
        `getSelectors` in interface `SelectorContainer`
      Parameters:
        `p` - the current project
      Returns:
        a `FileSelector[]` of the selectors in this container.

    - #### selectorElements

          public java.util.Enumeration<FileSelector> selectorElements()

      Returns an enumerator for accessing the set of selectors.
      Specified by:
        `selectorElements` in interface `SelectorContainer`
      Returns:
        an `Enumeration` of selectors.

    - #### appendSelector

          public void appendSelector(FileSelector selector)

      Add a new selector into this container.
      Specified by:
        `appendSelector` in interface `SelectorContainer`
      Parameters:
        `selector` - the new `FileSelector` to add.

    - #### addSelector

          public void addSelector(SelectSelector selector)

      Add a "Select" selector entry on the selector list.
      Specified by:
        `addSelector` in interface `SelectorContainer`
      Parameters:
        `selector` - the `SelectSelector` to add.

    - #### addAnd

          public void addAnd(AndSelector selector)

      Add an "And" selector entry on the selector list.
      Specified by:
        `addAnd` in interface `SelectorContainer`
      Parameters:
        `selector` - the `AndSelector` to add.

    - #### addOr

          public void addOr(OrSelector selector)

      Add an "Or" selector entry on the selector list.
      Specified by:
        `addOr` in interface `SelectorContainer`
      Parameters:
        `selector` - the `OrSelector` to add.

    - #### addNot

          public void addNot(NotSelector selector)

      Add a "Not" selector entry on the selector list.
      Specified by:
        `addNot` in interface `SelectorContainer`
      Parameters:
        `selector` - the `NotSelector` to add.

    - #### addNone

          public void addNone(NoneSelector selector)

      Add a "None" selector entry on the selector list.
      Specified by:
        `addNone` in interface `SelectorContainer`
      Parameters:
        `selector` - the `NoneSelector` to add.

    - #### addMajority

          public void addMajority(MajoritySelector selector)

      Add a majority selector entry on the selector list.
      Specified by:
        `addMajority` in interface `SelectorContainer`
      Parameters:
        `selector` - the `MajoritySelector` to add.

    - #### addDate

          public void addDate(DateSelector selector)

      Add a selector date entry on the selector list.
      Specified by:
        `addDate` in interface `SelectorContainer`
      Parameters:
        `selector` - the `DateSelector` to add.

    - #### addSize

          public void addSize(SizeSelector selector)

      Add a selector size entry on the selector list.
      Specified by:
        `addSize` in interface `SelectorContainer`
      Parameters:
        `selector` - the `SizeSelector` to add.

    - #### addDifferent

          public void addDifferent(DifferentSelector selector)

      Add a DifferentSelector entry on the selector list.
      Specified by:
        `addDifferent` in interface `SelectorContainer`
      Parameters:
        `selector` - the `DifferentSelector` to add.

    - #### addFilename

          public void addFilename(FilenameSelector selector)

      Add a selector filename entry on the selector list.
      Specified by:
        `addFilename` in interface `SelectorContainer`
      Parameters:
        `selector` - the `FilenameSelector` to add.

    - #### addType

          public void addType(TypeSelector selector)

      Add a selector type entry on the selector list.
      Specified by:
        `addType` in interface `SelectorContainer`
      Parameters:
        `selector` - the `TypeSelector` to add.

    - #### addCustom

          public void addCustom(ExtendSelector selector)

      Add an extended selector entry on the selector list.
      Specified by:
        `addCustom` in interface `SelectorContainer`
      Parameters:
        `selector` - the `ExtendSelector` to add.

    - #### addContains

          public void addContains(ContainsSelector selector)

      Add a contains selector entry on the selector list.
      Specified by:
        `addContains` in interface `SelectorContainer`
      Parameters:
        `selector` - the `ContainsSelector` to add.

    - #### addPresent

          public void addPresent(PresentSelector selector)

      Add a present selector entry on the selector list.
      Specified by:
        `addPresent` in interface `SelectorContainer`
      Parameters:
        `selector` - the `PresentSelector` to add.

    - #### addDepth

          public void addDepth(DepthSelector selector)

      Add a depth selector entry on the selector list.
      Specified by:
        `addDepth` in interface `SelectorContainer`
      Parameters:
        `selector` - the `DepthSelector` to add.

    - #### addDepend

          public void addDepend(DependSelector selector)

      Add a depends selector entry on the selector list.
      Specified by:
        `addDepend` in interface `SelectorContainer`
      Parameters:
        `selector` - the `DependSelector` to add.

    - #### addContainsRegexp

          public void addContainsRegexp(ContainsRegexpSelector selector)

      Add a regular expression selector entry on the selector list.
      Specified by:
        `addContainsRegexp` in interface `SelectorContainer`
      Parameters:
        `selector` - the `ContainsRegexpSelector` to add.

    - #### addModified

          public void addModified(ModifiedSelector selector)

      Add the modified selector.
      Specified by:
        `addModified` in interface `SelectorContainer`
      Parameters:
        `selector` - the `ModifiedSelector` to add.
      Since:
        ant 1.6

    - #### addReadable

          public void addReadable(ReadableSelector r)

    - #### addWritable

          public void addWritable(WritableSelector w)

    - #### add

          public void add(FileSelector selector)

      Add an arbitrary selector.
      Specified by:
        `add` in interface `SelectorContainer`
      Parameters:
        `selector` - the `FileSelector` to add.
      Since:
        Ant 1.6

    - #### toString

          public java.lang.String toString()

      Returns included files as a list of semicolon-separated filenames.
      Overrides:
        `toString` in class `DataType`
      Returns:
        a `String` of included filenames.

    - #### clone

          public java.lang.Object clone()

      Creates a deep clone of this instance, except for the nested selectors (the list of selectors is a shallow clone of this instance's list).
      Overrides:
        `clone` in class `DataType`
      Returns:
        the cloned object
      Since:
        Ant 1.6

    - #### mergeIncludes

          public java.lang.String[] mergeIncludes(Project p)

      Get the merged include patterns for this AbstractFileSet.
      Parameters:
        `p` - the project to use.
      Returns:
        the include patterns of the default pattern set and all nested patternsets.
      Since:
        Ant 1.7

    - #### mergeExcludes

          public java.lang.String[] mergeExcludes(Project p)

      Get the merged exclude patterns for this AbstractFileSet.
      Parameters:
        `p` - the project to use.
      Returns:
        the exclude patterns of the default pattern set and all nested patternsets.
      Since:
        Ant 1.7

    - #### mergePatterns

          public PatternSet mergePatterns(Project p)

      Get the merged patterns for this AbstractFileSet.
      Parameters:
        `p` - the project to use.
      Returns:
        the default patternset merged with the additional sets in a new PatternSet instance.
      Since:
        Ant 1.7

    - #### dieOnCircularReference

          protected void dieOnCircularReference(java.util.Stack<java.lang.Object> stk,
                                    Project p)
                                         throws BuildException

      Description copied from class: `DataType`
      Check to see whether any DataType we hold references to is included in the Stack (which holds all DataType instances that directly or indirectly reference this instance, including this instance itself).

      If one is included, throw a BuildException created by `circularReference`.

      This implementation is appropriate only for a DataType that cannot hold other DataTypes as children.

      The general contract of this method is that it shouldn't do anything if ``checked`` is true and set it to true on exit.

      Overrides:
        `dieOnCircularReference` in class `DataType`
      Parameters:
        `stk` - the stack of references to check.
        `p` - the project to use to dereference the references.
      Throws:
        `BuildException` - on error.