From 78ba5f07530c5aaf81dfd8f7643180af7359effd Mon Sep 17 00:00:00 2001
From: Stefan Bodewig
Date: Fri, 26 Sep 2008 12:00:51 +0000
Subject: [PATCH] Add a firstmatchmapper. PR 44873.
git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@699288 13f79535-47bb-0310-9956-ffa450edef68
---
WHATSNEW | 5 ++
docs/manual/CoreTypes/mapper.html | 33 +++++++++++++
.../tools/ant/types/defaults.properties | 1 +
.../tools/ant/util/FirstMatchMapper.java | 48 +++++++++++++++++++
src/tests/antunit/types/firstmatch-test.xml | 41 ++++++++++++++++
5 files changed, 128 insertions(+)
create mode 100644 src/main/org/apache/tools/ant/util/FirstMatchMapper.java
create mode 100644 src/tests/antunit/types/firstmatch-test.xml
diff --git a/WHATSNEW b/WHATSNEW
index 6c737aaf7..edbb93284 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -385,6 +385,11 @@ Other changes:
* 's order of results is now predictable.
Bugzilla Report 44873
+ * a new has been added, which works similar to
+ but only returns the results of the first nested
+ mapper that matches.
+ Bugzilla Report 44873
+
Changes from Ant 1.7.0 TO Ant 1.7.1
=============================================
diff --git a/docs/manual/CoreTypes/mapper.html b/docs/manual/CoreTypes/mapper.html
index e55652e60..a7cf83773 100644
--- a/docs/manual/CoreTypes/mapper.html
+++ b/docs/manual/CoreTypes/mapper.html
@@ -887,6 +887,39 @@ list of mapped names reset after every invocation.
<mapper type>
attribute.
+
+
+ This mapper supports an arbitrary number of nested mappers and
+ returns the results of the first mapper that matches. This is
+ different from composite mapper
+ which collects the results of all matching children.
+Examples:
+
+<firstmatchmapper>
+ <globmapper from="*.txt" to="*.bak"/>
+ <globmapper from="*A.*" to="*B.*"/>
+</firstmatchmapper>
+
+
+
+
+ Source file name |
+ Target file names |
+
+
+ foo/bar/A.txt |
+ foo/bar/A.bak |
+
+
+ foo/bar/A.java |
+ foo/bar/B.java |
+
+
+
+ The firstmatchmapper has no corresponding
+ <mapper type>
attribute.
+
+