Interface AdditionalTasks

  • All Superinterfaces:
    java.io.Serializable
    Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface AdditionalTasks
    extends java.io.Serializable
    AdditionalTasks - Documentation.

    This class is a Java Functional Interface. If an implementation of this interface is registered with the Upgrader - whenever a Java-Doc Web-Page is loaded and processed, the last step of the processing of the Vectorized-HTML will be to invoke to the AdditionalTasks.accept(...) method. The programmer may use this Interface to make "Special Requests" that need to be performed on the Java-Doc '.html' page.

    AdditionalTasks doesn't make any constraints or requirements for what the programmer does or does not need to do with these parameters that are received. Suffice it to say, if any kind of post processing needs to be done on the '.html' web-page (after the Java-Doc Updater Logic has finished its processing) such as: adding HiLited Code, adding more CSS-Tags, and inlining HTML Meta-Tag Information this Functinal Interface - then the programmer should provide an AdditionalTask's implementation to the upgrader.

    To register an AdditionalTasks, invoke the method: Upgrade.setAdditionalTasks(AdditionalTasks)

    The seven arguments that are provided to the user are as follows:

    • Vector<HTMLNode>

      Which is the Vectorized/Parsed Java-Doc Generated Web-Page for any Class, Interface, or Enumerated Type. This is the page that end-users see when they are reading a Java Documentation Site

    • String jdFileName

      This would be the complete File-System File-Name for any Java-Doc HTML Web-Page. The file stored at this location in the file-system is the name of the file that was loaded into the Vectorized-HTML of the previous parameter.

    • String srcCodeFileName

      This parameter represents the name of the source-file that was used to generate the Java-Doc Generated Web-Page for a class, interface or enumerated-type listed in the previous two-parameters.

    • String cietFullName

      For Java Doc HTML Classes, this would be the "complete package.class name" of the class represented by this vectorized-page. This is the same for interfaces and also enumerated-types. The acronym "CIET" literally stands for Class, Interface or Enumerated Type. For example the "Complete Name" of the commonly used Java Class 'Vector' would be 'java.util.Vector'

    • JavaSourceCodeFile jscf

      This is a wrapper or 'bridge class' that has extracted as much pertinent information about this class using the external-public library Java-Parser. It is important to remember that the Java-Doc Tools cannot run without having the Java-Parser Jar-Library included in the Compiler's Classpath. This instance lists the Methods, Constructors etc... along with the parameters, modifiers and even comments in the '.java' file.

    • JavaDocHTMLFile jdhf

      This is the parsed '.html' file object that contains (largely duplicate) information that's inside the instance of JavaSourceCodeFile. It is created by parsing the web-page that was generated by the original JavaDoc utility.

    • StorageWriter sw

      Used to print messages about the processing to the terminal or log.

    This is one "version of" an Additional Tasks implementation. This is used to insert the standard Open-Graph and other Search-Engine-Optimization (SEO) HTML '<META>' Tags into each of the HTML pages. This method is registered with the upgrader using the line listed below. It uses Java's double-colon '::' syntax:
    upgrade.setAdditionalTasks(BuildClass::accept)

    The class named "BuildClass" is the name of whatever class in which this method resides. Notice Java's '::' double-colon function pointer. Also notice, that in this implementation of 'AdditionalTasks' - most of the input parameters are just discarded & not-used by the method at all. There are no expectations on what this interface has to do.

    Example:
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    // This is an example implementation of the "functional interface" AdditionalTasks
    // Again, to assign this to the upgrade tool, use the 'setAdditionalTasks(function-pointer)' method, 
    // and make sure to point to a method such as below.  The parameters passed here do not have to be 
    // used, although they are provided (just in case) other processing or calculations are needed.
    
    public static void accept(
            Vector<HTMLNode> fileVec, String jdFileName, String srcFileName, String cietName,
            JavaSourceCodeFile jscf, JavaDocHTMLFile jdhf, StorageWriter sw
        )
    {
        // Simple "Open Graph" protocol entries
        Meta.insertOGMetaTag     (fileVec, "site_name",              "www.Torello.Directory");
        Meta.insertOGMetaTag     (fileVec, "image",                  "http://Developer.Torello.Directory/JavaHTML/favicon.jpg");
        Meta.insertOGMetaTag     (fileVec, "url",                    "http://Developer.Torello.Directory/JavaHTML/index.html");
        Meta.insertOGMetaTag     (fileVec, "type",                   "Java.HTML");
    
        // Standard HTML Meta Element "Meta Tags"
        Meta.insertMetaTagName   (fileVec, MetaTagName.author,       "Ralph P. Torello, et. al.");
        Meta.insertMetaTagName   (fileVec, MetaTagName.contact,      "Ralph@Torello.Directory");
        Meta.insertMetaTagName   (fileVec, MetaTagName.keywords,     "Torello, Java, HTML, Search, Search-Engine, Scrape, Scrape-Package, Web-Scrape, HTML-Scrape, Java Vectors, HTML Search, Find, Get, Peek, Poll, Meta Tags, Regular Expressions, OpenGraph, News");
        Meta.insertMetaTagName   (fileVec, MetaTagName.webAuthor,    "Torello Software & Publishing.");
    
        // Typical Search Engine's "Canonical URL" assignment.
        Features.insertCanonicalURL(fileVec, "http://developer.torello.directory/JavaHTML/Version 1/1.5/javadoc/index.html");     
    }
    



    • Field Detail

      • serialVersionUID

        static final long serialVersionUID
        This fulfils the SerialVersion UID requirement for all classes that implement Java's interface java.io.Serializable. Using the Serializable Implementation offered by java is very easy, and can make saving program state when debugging a lot easier. It can also be used in place of more complicated systems like "hibernate" to store data as well.

        Functional Interfaces are usually not thought of as Data Objects that need to be saved, stored and retrieved; however, having the ability to store intermediate results along with the lambda-functions that helped get those results can make debugging easier.
        See Also:
        Constant Field Values
        Code:
        Exact Field Declaration Expression:
        1
        public static final long serialVersionUID = 1;
        
    • Method Detail

      • accept

        void accept​(java.util.Vector<HTMLNode> html,
                    java.lang.String jdFileName,
                    java.lang.String srcCodeFileName,
                    java.lang.String cietFullName,
                    JavaSourceCodeFile jscf,
                    JavaDocHTMLFile jdhf,
                    StorageWriter sw)
        Implementing this method should allow a programmer to further-modify the contents of a Java-Doc Generated HTML Web-Page, after the Upgrade-Logic has performed it's HiLiting, and CSS-Tag additions, and cleanup. Clearly, the only parameter in this list that is mandatory to use is the HTML Vector itself. The other String's and the parsed instance of parameter 'SourceFile sf' are merely there for convenience. These should provide all the information that the Upgrader has at its disposal to the end user. The software-logic that builds the documentation pages for this class (the page that your are looking at right now) implements an 'AddtionalTasks' and performs some last adjustments to the classes in the package HTML.NodeSearch.
        Parameters:
        html - This is the vectorized-html for the Java-Doc Generated Web-Page CIET File.
        jdFileName - This method will be invoked with parameter 'jdFileName' receiving the actual file-system full-path name of the JavaDoc '.html' file for the class, interface or enumerated-type being reviewed / updated.
        srcCodeFileName - On invocation, this parameter will receive the actual file-system full-path name for the '.java' source-code file of the class, interface or enumerated-type being reviewed / updated.
        cietFullName - The acronym "CIET" merely refers to the words "Class, Interface or Enumerated-Type." This is usually almost identical to the String 'jdFileName' but has had all of the File.separator characters converted into periods '.'.
        jscf - This is an instance-reference for the PARSED '.java' Source-Code File that has been parsed by the Java-Parser Bridge classes using the JavaParser Library. The parsed file instance has lists of all the Methods, Fields, Constructors, and Enumerated-Type Constants that are contained by whatever Class, Interface, or Enum is being parsed. The Java Parser Tool was written in part by somebody named: Federico Tomasetti. All of this information shall be available as a String.
        jdhf - This is an instance-reference for the PARSED '.html' HTML Documentation page. This parse is different - as it has been generated by the Java Doc HTML web-page parser. It will also contain the list of methods, fields and constructors that were identified in the javadoc-generated HTML documentation page for this class, interface or enumerated-type.
        sw - This is the log, and information can be printed to the terminal at the discretion of the programmer.