tags:

views:

37

answers:

1

Generally speaking, any ant task which accepts a will also accept several tags designating particular mappers: , , etc.

But if you're writing your own task, you are supposed to supply a method for each possible tag that may exist inside your task. You don't want to add separate addConfiguredMapper(), addConfiguredIdentityMapper(), addConfiguredRegexMapper(), etc. methods. How do you easily set up a custom ant Task to take any arbitrary Mapper, specified by either the general tag or the tag for each particular instance?

A: 

These are the two methods you will need to supply:

public Mapper createMapper() throws BuildException;
public void add(FileNameMapper fileNameMapper);

Take a look at the Copy task in the ant source distribution to see how these are implemented.

skiphoppy