FirstMatchMapper (Apache Ant API)
Description: declaration: package: org.apache.tools.ant.util, class: FirstMatchMapper

# Class FirstMatchMapper

java.lang.Object
org.apache.tools.ant.util.ContainerMapper
org.apache.tools.ant.util.FirstMatchMapper

All Implemented Interfaces:
  `FileNameMapper`

public class FirstMatchMapper extends ContainerMapper
A `ContainerMapper` that returns the results of its first constituent `FileNameMapper`s that matches.

Since:
  Ant 1.8.0

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `FirstMatchMapper()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String[]`
  `mapFileName(String sourceFileName)`
  Returns an array containing the target filename(s) for the given source file.

  ### Methods inherited from class ContainerMapper

  `add, addConfigured, addConfiguredMapper, contains, getMappers, setFrom, setTo`
  Modifier and Type
  Method
  Description
  `void`
  `add(FileNameMapper fileNameMapper)`
  Add a `FileNameMapper`.
  `void`
  `addConfigured(FileNameMapper fileNameMapper)`
  An add configured version of the add method.
  `void`
  `addConfiguredMapper(Mapper mapper)`
  Add a `Mapper`.
  `protected boolean`
  `contains(FileNameMapper fileNameMapper)`
  Return `true` if this `ContainerMapper` or any of its sub-elements contains the specified `FileNameMapper`.
  `List<FileNameMapper>`
  `getMappers()`
  Get the `List` of `FileNameMapper`s.
  `void`
  `setFrom(String ignore)`
  Empty implementation.
  `void`
  `setTo(String ignore)`
  Empty implementation.

  ### Methods inherited from class Object

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

- ## Constructor Details

  - ### FirstMatchMapper

    public FirstMatchMapper()

- ## Method Details

  - ### mapFileName

    public String[] mapFileName(String sourceFileName)
    Returns an array containing the target filename(s) for the given source file.

    if the given rule doesn't apply to the source file, implementation must return null. SourceFileScanner will then omit the source file in question.

    .
    Parameters:
      `sourceFileName` - the name of the source file relative to some given basedirectory. Might be `null` for resources that don't provide a name.
    Returns:
      an array of strings if the rule applies to the source file, or null if it does not.