}
File outputFile = new File(outputDir, fileName);
outputFile.getParentFile().mkdirs();
SugarGenerator sugarGenerator = new SugarGenerator();
try {
sugarGenerator.addWriter(new HamcrestFactoryWriter(
packageName, shortClassName, new FileWriter(outputFile)));
sugarGenerator.addWriter(new QuickReferenceWriter(System.out));
XmlConfigurator xmlConfigurator
= new XmlConfigurator(sugarGenerator, XmlConfigurator.class.getClassLoader());
if (srcDirs.trim().length() > 0) {
for (String srcDir : srcDirs.split(",")) {
xmlConfigurator.addSourceDir(new File(srcDir));
}
}
xmlConfigurator.load(new InputSource(configFile));
System.out.println("Generating " + fullClassName);
sugarGenerator.generate();
} finally {
sugarGenerator.close();
}
}