Class EclipseCollectionsCodeGenerator


  • public class EclipseCollectionsCodeGenerator
    extends java.lang.Object
    • 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 long calculateChecksum​(java.lang.String string)  
      private void checkSumClassContentsAndWrite​(java.lang.String classContents, java.io.File outputFile)  
      private java.io.File constructTargetPath​(org.stringtemplate.v4.STGroupFile templateFile)  
      private java.lang.String executeTemplate​(org.stringtemplate.v4.STGroupFile templateFile, java.lang.String templateName, Primitive primitive)  
      private java.lang.String executeTemplate​(org.stringtemplate.v4.STGroupFile templateFile, java.lang.String templateName, Primitive primitive1, Primitive primitive2)  
      private org.stringtemplate.v4.ST findTemplate​(org.stringtemplate.v4.STGroupFile templateFile, java.lang.String templateName)  
      int generateFiles()
      Generates code and only write contents to disk which differ from the current file contents.
      private boolean renderBooleanTemplate​(org.stringtemplate.v4.STGroupFile templateFile, java.lang.String templateName)  
      private static boolean sourceFileExists​(java.io.File outputFile)  
      private void writeFileAndChecksum​(java.io.File outputFile, java.lang.String output, long checksumValue, java.nio.file.Path outputChecksumPath, boolean outputFileMustExist)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • templateDirectory

        private final java.lang.String templateDirectory
      • classPathURLs

        private final java.util.List<java.net.URL> classPathURLs
      • 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)