in freemarker-generator-cli/src/main/java/org/apache/freemarker/generator/cli/config/DataModelSupplier.java [75:90]
private Map<String, Object> toDataModel(String source) {
final DataSource dataSource = dataSourceLoader.load(source);
final NamedUri namedUri = NamedUriStringParser.parse(source);
final boolean isExplodedDataModel = !namedUri.hasName();
final String contentType = dataSource.getContentType();
if (contentType.startsWith(MIME_APPLICATION_JSON)) {
return fromJson(dataSource, isExplodedDataModel);
} else if (isYamlDataSource(dataSource)) {
return fromYaml(dataSource, isExplodedDataModel);
} else if (contentType.startsWith(MIME_TEXT_PLAIN)) {
return fromProperties(dataSource, isExplodedDataModel);
} else {
throw new IllegalArgumentException("Don't know how to handle content type: " + contentType);
}
}