Class Files


  • public class Files
    extends java.lang.Object
    Given a list of packges, collate a list of files to processed by the various Build-Stages.



    Stateless Class:
    This class neither contains any program-state, nor can it be instantiated. The @StaticFunctional Annotation may also be called 'The Spaghetti Report'. Static-Functional classes are, essentially, C-Styled Files, without any constructors or non-static member fields. It is a concept very similar to the Java-Bean's @Stateless Annotation.

    • 1 Constructor(s), 1 declared private, zero-argument constructor
    • 3 Method(s), 3 declared static
    • 1 Field(s), 1 declared static, 1 declared final


    • Method Summary

       
      Retrieve Files-to-Process List for Build-Stage 1, 'javac'
      Modifier and Type Method
      static ReadOnlyList<String> filesToCompile​(ReadOnlyList<BuildPackage> packagesToCompile, Appendable logAndScreen)
       
      Retrieve Files-to-Process List for Build-Stage 2, 'javadoc'
      Modifier and Type Method
      static ReadOnlyList<String> filesToJavaDoc​(ReadOnlyList<BuildPackage> packagesToJavaDoc, Appendable logAndScreen)
      • Methods inherited from class java.lang.Object

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

      • filesToCompile

        🡇     🗕  🗗  🗖
        public static ReadOnlyList<java.lang.String> filesToCompile​
                    (ReadOnlyList<BuildPackage> packagesToCompile,
                     java.lang.Appendable logAndScreen)
                throws java.io.IOException
        
        Retrieve the Stage 1 Files List of '.java' Files. The master list that is returned as a result of this method is the complete list of files sent to 'javac', as command line parameters.
        Parameters:
        packagesToCompile - The list of packages whose files need to be compiled. This list, itself, was built by class Packages method builder using all User-Provided Configurations, and Command-Line Switch Choices.
        logAndScreen - Prints log information to both the log and the terminal-screen.
        Returns:
        The list of files to be compiled by the Stage 1 Build-Class S01_JavaCompiler.
        Throws:
        java.io.IOException - Required due to the Appendable parameter 'logAndScreen'
        See Also:
        Printing.printFilesCount(ReadOnlyList, ArrayList, Appendable), BuildPackage.pkgRootDirectory, BuildPackage.hasSubPackages, BuildPackage.hasUpgradeFilesDir, BuildPackage.hasPackageSourceDir, BuildPackage.helperPackages
        Code:
        Exact Method Body:
         // This is much easier to understand.  It is actually smarter to just go to the class
         // "Files" and look what it is doing.  The loop that collects the files for a "Package"
         // uses the following BuildPackage boolean-fields, which are defined, as below, inside the
         // BuildPackage-Constructor:
         //
         // BuildPackage.hasSubPackages     = (flags & HAS_SUB_PACKAGES)    >= 1;
         // BuildPackage.pkgRootDirectory   = classPathLocation + fullName.replace(".", FS) + FS;
         //
         // this.helperPackages = (helperPackages == null) || (helperPackages.length == 0)
         //     ? EMPTY_LIST
         //     : ReadOnlyList.of(helperPackages);
         //
         // Just go to class "Files" to see how those "BuildPackage" boolean Configuration-Fields
         // pick files to insert into the "filesToCompile" list.
        
         // This keeps a complete list of all files that will need to be compiled
         ROArrayListBuilder<String> b = new ROArrayListBuilder<>();
        
         // This is used for printing to the screen only, it is discarded when this method
         // exits.
        
         final ArrayList<Integer> packageFilesCount = new ArrayList<>(packagesToCompile.size());
        
         for (final BuildPackage pkg : packagesToCompile)
         {
             int count = 0;
        
             count += addMore(b, pkg.pkgRootDirectory, pkg.hasSubPackages, FileNode.JAVA_FILES);
        
             if (pkg.hasUpgradeFilesDir) count += addMore
                 (b, pkg.pkgRootDirectory + "upgrade-files" + FS, true, FileNode.JAVA_FILES);
        
             if (pkg.hasPackageSourceDir) count += addMore
                 (b, pkg.pkgRootDirectory + "package-source" + FS, true, FileNode.JAVA_FILES);
        
             for (String helperPkgDirName : pkg.helperPackages) count += addMore
                 (b, helperPkgDirName, false, FileNode.JAVA_FILES);
        
             packageFilesCount.add(Integer.valueOf(count));
         }
        
         Printing.printFilesCount(packagesToCompile, packageFilesCount, logAndScreen);
        
         return b.build();
        
      • filesToJavaDoc

        🡅     🗕  🗗  🗖
        public static ReadOnlyList<java.lang.String> filesToJavaDoc​
                    (ReadOnlyList<BuildPackage> packagesToJavaDoc,
                     java.lang.Appendable logAndScreen)
                throws java.io.IOException
        
        Retrieve the Stage 1 Files List of '.java' Files. The master list that is returned as a result of this method is the complete list of files sent to 'javadoc', as command line parameters.
        Parameters:
        packagesToJavaDoc - The list of packages whose files need to be compiled. This list, itself, was built by class Packages method builder using all User-Provided Configurations, and Command-Line Switch Choices.
        logAndScreen - Prints log information to both the log and the terminal-screen.
        Returns:
        The list of files to be compiled by the Stage 2 Build-Class S02_JavaDoc.
        Throws:
        java.io.IOException - Required due to the Appendable parameter 'logAndScreen'
        See Also:
        Printing.printFilesCount(ReadOnlyList, ArrayList, Appendable), BuildPackage.pkgRootDirectory, BuildPackage.hasPackageSourceDir
        Code:
        Exact Method Body:
         // This keeps a complete list of all files that will need to be compiled
         ROArrayListBuilder<String> b = new ROArrayListBuilder<>();
        
         // This is used for printing to the screen only, it is discarded when this method
         // exits.
        
         final ArrayList<Integer> packageFilesCount = new ArrayList<>(packagesToJavaDoc.size());
        
         for (final BuildPackage pkg : packagesToJavaDoc)
         {
             int count = 0;
        
             count += addMore(b, pkg.pkgRootDirectory, false, FileNode.JAVA_FILES);
        
             if (pkg.hasPackageSourceDir) count += addMore
                 (b, pkg.pkgRootDirectory + "package-source" + FS, true, FileNode.JAVA_FILES);
        
             packageFilesCount.add(Integer.valueOf(count));
         }
        
         Printing.printFilesCount(packagesToJavaDoc, packageFilesCount, logAndScreen);
        
         return b.build();