Map<String, Object> model = new HashMap<String,Object>();
model.put("extensions", discoveredBeanFactories);
model.put("categoryClasses", categoryClasses);
JavaFileObject sourceFile = filer.createSourceFile(BEAN_FACTORY_FILENAME);
OutputStream output = sourceFile.openOutputStream();
new TemplateProcessor().process(BEAN_FACTORY_TEMPLATE, model, output);
output.flush();
output.close();
}