ExtendSelector (Apache Ant API)
Date: 2018-07-10

org.apache.tools.ant.types.selectors

## Class ExtendSelector

- java.lang.Object
- - org.apache.tools.ant.ProjectComponent
  - - org.apache.tools.ant.types.DataType
    - - org.apache.tools.ant.types.selectors.BaseSelector
      - - org.apache.tools.ant.types.selectors.ExtendSelector

- All Implemented Interfaces:
    java.lang.Cloneable, ResourceSelector, FileSelector

      public class ExtendSelector
      extends BaseSelector

  Selector that selects files by forwarding the request on to other classes.
  Since:
    1.5

- - ### 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
    Constructor and Description
    `ExtendSelector()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addParam(Parameter p)` Create new parameters to pass to custom selector.
    `Path` | `createClasspath()` Specify the classpath to use to load the Selector (nested element).
    `Path` | `getClasspath()` Get the classpath
    `boolean` | `isSelected(java.io.File basedir, java.lang.String filename, java.io.File file)` Allows the custom selector to choose whether to select a file.
    `void` | `selectorCreate()` Instantiates the identified custom selector class.
    `void` | `setClassname(java.lang.String classname)` Sets the classname of the custom selector.
    `void` | `setClasspath(Path classpath)` Set the classpath to load the classname specified using an attribute.
    `void` | `setClasspathref(Reference r)` Set the classpath to use for loading a custom selector by using a reference.
    `void` | `verifySettings()` These are errors specific to ExtendSelector only.

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

      `getCheckedRef, getError, setError, setError, validate`

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

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

    - ### 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`

    - ### Methods inherited from interface org.apache.tools.ant.types.selectors.FileSelector

      `isSelected`

- - ### Constructor Detail

    - #### ExtendSelector

          public ExtendSelector()

  - ### Method Detail

    - #### setClassname

          public void setClassname(java.lang.String classname)

      Sets the classname of the custom selector.
      Parameters:
        `classname` - is the class which implements this selector

    - #### selectorCreate

          public void selectorCreate()

      Instantiates the identified custom selector class.

    - #### addParam

          public void addParam(Parameter p)

      Create new parameters to pass to custom selector.
      Parameters:
        `p` - The new Parameter object

    - #### setClasspath

          public final void setClasspath(Path classpath)

      Set the classpath to load the classname specified using an attribute.
      Parameters:
        `classpath` - the classpath to use

    - #### createClasspath

          public final Path createClasspath()

      Specify the classpath to use to load the Selector (nested element).
      Returns:
        a classpath to be configured

    - #### getClasspath

          public final Path getClasspath()

      Get the classpath
      Returns:
        the classpath

    - #### setClasspathref

          public void setClasspathref(Reference r)

      Set the classpath to use for loading a custom selector by using a reference.
      Parameters:
        `r` - a reference to the classpath

    - #### verifySettings

          public void verifySettings()

      These are errors specific to ExtendSelector only. If there are errors in the custom selector, it should throw a BuildException when isSelected() is called.
      Overrides:
        `verifySettings` in class `BaseSelector`

    - #### isSelected

          public boolean isSelected(java.io.File basedir,
                                    java.lang.String filename,
                                    java.io.File file)
                             throws BuildException

      Allows the custom selector to choose whether to select a file. This is also where the Parameters are passed to the custom selector, since we know we must have them all by now. And since we must know both classpath and classname, creating the class is deferred to here as well.
      Specified by:
        `isSelected` in interface `FileSelector`
      Specified by:
        `isSelected` in class `BaseSelector`
      Parameters:
        `basedir` - The the base directory.
        `filename` - The name of the file to check.
        `file` - A File object for this filename.
      Returns:
        whether the file should be selected or not.
      Throws:
        `BuildException` - if an error occurs.