use of edu.princeton.cs.algs4.ST in project buck by facebook.
the class IjProjectWriter method getST.
private static ST getST(StringTemplateFile file) throws IOException {
URL templateUrl = Resources.getResource(IjProjectWriter.class, file.getFileName());
String template = Resources.toString(templateUrl, StandardCharsets.UTF_8);
return new ST(template, DELIMITER, DELIMITER);
}
use of edu.princeton.cs.algs4.ST in project buck by facebook.
the class IjProjectWriter method writeProjectSettings.
private void writeProjectSettings(IJProjectCleaner cleaner, IjProjectConfig projectConfig) throws IOException {
Optional<String> sdkName = projectConfig.getProjectJdkName();
Optional<String> sdkType = projectConfig.getProjectJdkType();
if (!sdkName.isPresent() || !sdkType.isPresent()) {
return;
}
projectFilesystem.mkdirs(IDEA_CONFIG_DIR_PREFIX);
Path path = IDEA_CONFIG_DIR_PREFIX.resolve("misc.xml");
ST contents = getST(StringTemplateFile.MISC_TEMPLATE);
String languageLevelInIjFormat = getLanguageLevelFromConfig();
contents.add("languageLevel", languageLevelInIjFormat);
contents.add("jdk15", getJdk15FromLanguageLevel(languageLevelInIjFormat));
contents.add("jdkName", sdkName.get());
contents.add("jdkType", sdkType.get());
writeToFile(contents, path);
cleaner.doNotDelete(path);
}
use of edu.princeton.cs.algs4.ST in project buck by facebook.
the class IjProjectWriter method writeModulesIndex.
private Path writeModulesIndex() throws IOException {
projectFilesystem.mkdirs(IDEA_CONFIG_DIR_PREFIX);
Path path = IDEA_CONFIG_DIR_PREFIX.resolve("modules.xml");
ST moduleIndexContents = getST(StringTemplateFile.MODULE_INDEX_TEMPLATE);
moduleIndexContents.add("modules", projectDataPreparer.getModuleIndexEntries());
writeToFile(moduleIndexContents, path);
return path;
}
use of edu.princeton.cs.algs4.ST in project che by eclipse.
the class DynaProviderGenerator method generate.
public String generate() throws IOException {
dynaClasses = new ArrayList<>();
findDynaObjects();
ST st = getTemplate();
st.add("packageName", packageName);
st.add("className", className);
st.add("classes", dynaClasses);
return st.render();
}
use of edu.princeton.cs.algs4.ST in project infoarchive-sip-sdk by Enterprise-Content-Management.
the class StringTemplate method writeRow.
@Override
public void writeRow(D domainObject, Map<String, ContentInfo> contentInfo, PrintWriter writer) throws IOException {
ST template = prepareTemplate(templatePrototype, domainObject, contentInfo);
template.write(new NoIndentWriter(writer));
}
Aggregations