concept custom mapper in category ant

appears as: custom mapper, A custom mapper, Custom mappers
Ant in Action

This is an excerpt from Manning's book Ant in Action.

18.5. Developing a custom mapper

Many of the same tasks that take selectors also support the <mapper> datatype, which can rename files as they’re moved, copied, or imported into archives. Listing 18.5 shows a custom mapper that makes filenames uppercase.

Listing 18.5. A mapper that converts filenames to uppercase

A custom mapper must implement Ant’s FileNameMapper interface, which has three methods. We ignore two of the methods, and only implement the map-FileName() method. This method takes a string, the path of the file relative to the base of the fileset, and returns an array of strings, the mapped paths. Mappers are free to return multiple mappings for the same source file.