in freemarker-generator-maven-plugin/src/main/java/org/apache/freemarker/generator/maven/JsonPropertiesProvider.java [57:85]
public void providePropertiesFromFile(Path path, OutputGenerator.OutputGeneratorBuilder builder) {
final File jsonDataFile = path.toFile();
final Map<String, Object> data = parseJson(jsonDataFile);
Object obj = data.get("dataModel");
if (obj != null) {
builder.addDataModel((Map<String, Object>) obj);
} else {
builder.addDataModel(new HashMap<>());
}
obj = data.get("templateName");
if (obj == null) {
throw new RuntimeException("Require json data property not found: templateName");
}
builder.addTemplateLocation(templateDir.toPath().resolve(obj.toString()));
final String dataDirName = dataDir.getAbsolutePath();
final String jsonFileName = jsonDataFile.getAbsolutePath();
if (!jsonFileName.startsWith(dataDirName)) {
throw new IllegalStateException("visitFile() given file not in sourceDirectory: " + jsonDataFile);
}
String outputFileName = jsonFileName.substring(dataDirName.length() + 1);
outputFileName = outputFileName.substring(0, outputFileName.length() - 5);
final Path outputPath = outputDir.toPath();
final Path resolved = outputPath.resolve(outputFileName);
builder.addOutputLocation(resolved);
}