Class EclipseCollectionsCodeGenerator
- java.lang.Object
-
- org.eclipse.collections.codegenerator.EclipseCollectionsCodeGenerator
-
public class EclipseCollectionsCodeGenerator extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<java.net.URL>classPathURLsprivate ErrorListenererrorListenerprivate java.lang.StringfileExtensionprivate intnumFileWrittenprivate java.io.FileoutputDirectoryprivate java.lang.StringtemplateDirectory
-
Constructor Summary
Constructors Constructor Description EclipseCollectionsCodeGenerator(java.lang.String templateDirectory, java.util.List<java.net.URL> classPathURLs, ErrorListener errorListener, java.io.File outputDirectory, java.lang.String fileExtension)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static longcalculateChecksum(java.lang.String string)private voidcheckSumClassContentsAndWrite(java.lang.String classContents, java.io.File outputFile)private java.io.FileconstructTargetPath(org.stringtemplate.v4.STGroupFile templateFile)private java.lang.StringexecuteTemplate(org.stringtemplate.v4.STGroupFile templateFile, java.lang.String templateName, Primitive primitive)private java.lang.StringexecuteTemplate(org.stringtemplate.v4.STGroupFile templateFile, java.lang.String templateName, Primitive primitive1, Primitive primitive2)private org.stringtemplate.v4.STfindTemplate(org.stringtemplate.v4.STGroupFile templateFile, java.lang.String templateName)intgenerateFiles()Generates code and only write contents to disk which differ from the current file contents.private booleanrenderBooleanTemplate(org.stringtemplate.v4.STGroupFile templateFile, java.lang.String templateName)private static booleansourceFileExists(java.io.File outputFile)private voidwriteFileAndChecksum(java.io.File outputFile, java.lang.String output, long checksumValue, java.nio.file.Path outputChecksumPath, boolean outputFileMustExist)
-
-
-
Field Detail
-
templateDirectory
private final java.lang.String templateDirectory
-
classPathURLs
private final java.util.List<java.net.URL> classPathURLs
-
errorListener
private final ErrorListener errorListener
-
outputDirectory
private final java.io.File outputDirectory
-
fileExtension
private final java.lang.String fileExtension
-
numFileWritten
private int numFileWritten
-
-
Constructor Detail
-
EclipseCollectionsCodeGenerator
public EclipseCollectionsCodeGenerator(java.lang.String templateDirectory, java.util.List<java.net.URL> classPathURLs, ErrorListener errorListener, java.io.File outputDirectory, java.lang.String fileExtension)
-
-
Method Detail
-
generateFiles
public int generateFiles()
Generates code and only write contents to disk which differ from the current file contents.- Returns:
- The number of files written.
-
checkSumClassContentsAndWrite
private void checkSumClassContentsAndWrite(java.lang.String classContents, java.io.File outputFile)
-
calculateChecksum
private static long calculateChecksum(java.lang.String string)
-
writeFileAndChecksum
private void writeFileAndChecksum(java.io.File outputFile, java.lang.String output, long checksumValue, java.nio.file.Path outputChecksumPath, boolean outputFileMustExist)
-
executeTemplate
private java.lang.String executeTemplate(org.stringtemplate.v4.STGroupFile templateFile, java.lang.String templateName, Primitive primitive)
-
executeTemplate
private java.lang.String executeTemplate(org.stringtemplate.v4.STGroupFile templateFile, java.lang.String templateName, Primitive primitive1, Primitive primitive2)
-
findTemplate
private org.stringtemplate.v4.ST findTemplate(org.stringtemplate.v4.STGroupFile templateFile, java.lang.String templateName)
-
renderBooleanTemplate
private boolean renderBooleanTemplate(org.stringtemplate.v4.STGroupFile templateFile, java.lang.String templateName)
-
constructTargetPath
private java.io.File constructTargetPath(org.stringtemplate.v4.STGroupFile templateFile)
-
sourceFileExists
private static boolean sourceFileExists(java.io.File outputFile)
-
-