* required for correctness.
*/
private TemplateFactory setupOptimizerFactory(TemplateFactory templateFactory) {
// DataCommandConsolidator saves state so we need to create a new one
// every time we run it.
OptimizerProvider dataCommandConsolidatorProvider = new OptimizerProvider() {
public Switch getOptimizer() {
return new DataCommandConsolidator();
}
};
// SyntaxTreeOptimizer has no state so we can use the same object
// concurrently, but it is cheap to make so lets be consistent.
OptimizerProvider syntaxTreeOptimizerProvider = new OptimizerProvider() {
public Switch getOptimizer() {
return new SyntaxTreeOptimizer();
}
};
OptimizerProvider stripStructuralWhitespaceProvider = null;
if (options.getStripStructuralWhiteSpace()) {
// StructuralWhitespaceStripper has state so create a new one each time.
stripStructuralWhitespaceProvider = new OptimizerProvider() {
public Switch getOptimizer() {
return new StructuralWhitespaceStripper();
}
};
}