peterreilly 2003/08/13 02:05:22
Modified: docs/manual/CoreTypes custom-programming.html
Log:
fix selector example
Revision Changes Path
1.2 +23 -13 ant/docs/manual/CoreTypes/custom-programming.html
Index: custom-programming.html
===================================================================
RCS file: /home/cvs/ant/docs/manual/CoreTypes/custom-programming.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- custom-programming.html 13 Aug 2003 08:35:01 -0000 1.1
+++ custom-programming.html 13 Aug 2003 09:05:22 -0000 1.2
@@ -75,7 +75,7 @@
</blockquote>
<p>
- Adding the condition to the system is achieved as follows:
+ Adding the condition to the system is achieved as follows:
</p>
<blockquote>
<pre>
@@ -100,13 +100,14 @@
<p>
Custom selectors are datatypes that implement
<code>org.apache.tools.ant.types.selectors.FileSelector</code>.
- <p>There is only one method required.
- <code>public boolean isSelected(File basedir, String filename,
- File file)</code>.
- It returns true
- or false depending on whether the given file should be
- selected or not.
- </p>
+ </p>
+ <p>There is only one method required.
+ <code>public boolean isSelected(File basedir, String filename,
+ File file)</code>.
+ It returns true
+ or false depending on whether the given file should be
+ selected or not.
+ </p>
<p>
An example of a custom selection that selects filenames ending
in ".java" would be:
@@ -114,8 +115,9 @@
<blockquote>
<pre>
package com.mydomain;
+import java.io.File;
import org.apache.tools.ant.types.selectors.FileSelector;
-public class JavaSelector {
+public class JavaSelector implements FileSelector {
public boolean isSelected(File b, String filename, File f) {
return filename.toLowerCase().endsWith(".java");
}
@@ -123,8 +125,6 @@
</pre>
</blockquote>
<p>
- </p>
- <p>
Adding the selector to the system is achieved as follows:
</p>
<blockquote>
@@ -135,10 +135,20 @@
classpath="${mydomain.classes"/>
</pre>
</blockquote>
- <p>
+ <p>
This selector can now be used wherever a Core Ant selector
- is used.
+ is used, for example:
</p>
+ <blockquote>
+ <pre>
+<copy todir="to">
+ <fileset dir="src">
+ <javaselector/>
+ </fileset>
+</copy>
+ </pre>
+ </blockquote>
+
<p>
One may use
<code>org.apache.tools.ant.types.selectors.BaseSelector</code>,
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]