use of net.morimekta.providence.generator.format.json.JsonGeneratorFactory in project providence by morimekta.
the class GeneratorOptions method getFactories.
public Map<String, GeneratorFactory> getFactories() {
try {
FactoryLoader<GeneratorFactory> loader = new FactoryLoader<>(GeneratorFactory.MANIFEST_PROPERTY);
Map<String, GeneratorFactory> factories = new TreeMap<>();
factories.put("json", new JsonGeneratorFactory());
File currentDir = currentJarDirectory();
if (currentDir != null) {
File generators = new File(currentDir, "generator");
if (generators.isDirectory()) {
addToMap(factories, loader.getFactories(generators));
}
}
{
ProvidenceTools config = getConfig();
if (config.hasGeneratorPaths()) {
for (String path : config.getGeneratorPaths()) {
addToMap(factories, loader.getFactories(new File(path)));
}
}
}
for (File extra : extraGenerators) {
GeneratorFactory factory = loader.getFactory(extra);
factories.put(factory.generatorName(), factory);
}
return factories;
} catch (ProvidenceConfigException e) {
throw new UncheckedProvidenceConfigException(e);
}
}
Aggregations