Package org.apache.tools.ant.types.resources

## Class MappedResourceCollection

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

- All Implemented Interfaces:
    `java.lang.Cloneable`, `java.lang.Iterable<Resource>`, `ResourceCollection`

      public class MappedResourceCollection
      extends DataType
      implements ResourceCollection, java.lang.Cloneable

  Wrapper around a resource collections that maps the names of the other collection using a configured mapper.
  Since:
    Ant 1.8.0

- - ### 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 | Description
    --- | ---
    `MappedResourceCollection()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `add​(ResourceCollection c)` | Adds the required nested ResourceCollection.
    `void` | `add​(FileNameMapper fileNameMapper)` | Add a nested filenamemapper.
    `java.lang.Object` | `clone()` | Implement clone.
    `Mapper` | `createMapper()` | Define the mapper to map source to destination files.
    `protected void` | `dieOnCircularReference​(java.util.Stack<java.lang.Object> stk, Project p)` | Overrides the version of DataType to recurse on all DataType child elements that may have been added.
    `boolean` | `isFilesystemOnly()` | Indicate whether this ResourceCollection is composed entirely of Resources accessible via local filesystem conventions.
    `java.util.Iterator<Resource>` | `iterator()`
    `void` | `setCache​(boolean cache)` | Set whether to cache collections.
    `void` | `setEnableMultipleMappings​(boolean enableMultipleMappings)` | Set method of handling mappers that return multiple mappings for a given source path.
    `void` | `setRefid​(Reference r)` | Overrides the base version.
    `int` | `size()` | Learn the number of contained Resources.
    `java.lang.String` | `toString()` | Format this resource collection as a String.

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

      `checkAttributesAllowed, checkChildrenAllowed, circularReference, dieOnCircularReference, dieOnCircularReference, getCheckedRef, 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`

    - ### Methods inherited from interface java.lang.Iterable

      `forEach, spliterator`

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

      `isEmpty, stream`

- - ### Constructor Detail

    - #### MappedResourceCollection

          public MappedResourceCollection()

  - ### Method Detail

    - #### add

          public void add​(ResourceCollection c)
                   throws BuildException

      Adds the required nested ResourceCollection.
      Parameters:
        `c` - the ResourceCollection to add.
      Throws:
        `BuildException` - on error.

    - #### createMapper

          public Mapper createMapper()
                              throws BuildException

      Define the mapper to map source to destination files.
      Returns:
        a mapper to be configured.
      Throws:
        `BuildException` - if more than one mapper is defined.

    - #### add

          public void add​(FileNameMapper fileNameMapper)

      Add a nested filenamemapper.
      Parameters:
        `fileNameMapper` - the mapper to add.
      Since:
        Ant 1.6.3

    - #### setEnableMultipleMappings

          public void setEnableMultipleMappings​(boolean enableMultipleMappings)

      Set method of handling mappers that return multiple mappings for a given source path.
      Parameters:
        `enableMultipleMappings` - If true the type will use all the mappings for a given source path, if false, only the first mapped name is processed. By default, this setting is false to provide backward compatibility with earlier releases.
      Since:
        Ant 1.8.1

    - #### setCache

          public void setCache​(boolean cache)

      Set whether to cache collections.
      Parameters:
        `cache` - boolean
      Since:
        Ant 1.8.1

    - #### isFilesystemOnly

          public boolean isFilesystemOnly()

      Indicate whether this ResourceCollection is composed entirely of Resources accessible via local filesystem conventions. If true, all resources returned from this collection should respond with a `FileProvider` when asked via `Resource.as(java.lang.Class<T>)`.
      Specified by:
        `isFilesystemOnly` in interface `ResourceCollection`
      Returns:
        whether this is a filesystem-only resource collection.

    - #### size

          public int size()

      Learn the number of contained Resources.
      Specified by:
        `size` in interface `ResourceCollection`
      Returns:
        number of elements as int.

    - #### iterator

          public java.util.Iterator<Resource> iterator()

      Specified by:
        `iterator` in interface `java.lang.Iterable<Resource>`

    - #### setRefid

          public void setRefid​(Reference r)

      Overrides the base version.
      Overrides:
        `setRefid` in class `DataType`
      Parameters:
        `r` - the Reference to set.

    - #### clone

          public java.lang.Object clone()

      Implement clone. The nested resource collection and mapper are copied.
      Overrides:
        `clone` in class `DataType`
      Returns:
        a cloned instance.

    - #### dieOnCircularReference

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

      Overrides the version of DataType to recurse on all DataType child elements that may have been added.
      Overrides:
        `dieOnCircularReference` in class `DataType`
      Parameters:
        `stk` - the stack of data types to use (recursively).
        `p` - the project to use to dereference the references.
      Throws:
        `BuildException` - on error.

    - #### toString

          public java.lang.String toString()

      Format this resource collection as a String.
      Overrides:
        `toString` in class `DataType`
      Returns:
        a descriptive `String`.