Wrap and delegate:
<map:generate src="superGenerator" src="uri"> <map:parameter name="class" value="GeneratorX"/> </map:generate>
public class SuperGenerator implements Generator {
Generator specialGenerator;
public void setup(SourceResolver resolver, Map objectModel, String srcURI, Parameters par) {
specialGenerator = (Generator) Class.forName(par.getParameter("class")).newInstance();
specialGenerator.setup(resolver, objectModel, srcURI, par);
}
public void generate() { specialGenerator.generate(); } }
You could also make all your generators Avalon components and retrieve them via a ServiceManager, if you wish, instead of using Class.forName.
Hope you get the idea.
IMO this looks massively like a hack around a restriction we set up. Maybe we should think about the restriction itself ...
Joerg
