private static Map fromProperties()

in freemarker-generator-cli/src/main/java/org/apache/freemarker/generator/cli/config/DataModelSupplier.java [111:127]


    private static Map<String, Object> fromProperties(DataSource dataSource, boolean isExplodedDataModel) {
        final Map<String, Object> result = new HashMap<>();
        final URI uri = dataSource.getUri();

        if (UriUtils.isEnvUri(uri) && !"env:///".equals(uri.toString())) {
            result.put(dataSource.getName(), dataSource.getText());
        } else {
            final Properties properties = PropertiesFactory.create(dataSource.getText());
            if (isExplodedDataModel) {
                properties.forEach((key, value) -> result.put(key.toString(), value));
            } else {
                result.put(dataSource.getName(), properties);
            }
        }

        return result;
    }