Class DetailNodeTreeStringPrinter


  • public final class DetailNodeTreeStringPrinter
    extends java.lang.Object
    Parses file as javadoc DetailNode tree and prints to system output stream.
    • Field Detail

      • LINE_SEPARATOR

        private static final java.lang.String LINE_SEPARATOR
        OS specific line separator.
      • JAVADOC_START

        private static final java.lang.String JAVADOC_START
        Symbols with which javadoc starts.
        See Also:
        Constant Field Values
    • Constructor Detail

      • DetailNodeTreeStringPrinter

        private DetailNodeTreeStringPrinter()
        Prevent instances.
    • Method Detail

      • printFileAst

        public static java.lang.String printFileAst​(java.io.File file)
                                             throws java.io.IOException
        Parse a file and print the parse tree.
        Parameters:
        file - the file to print.
        Returns:
        parse tree as a string
        Throws:
        java.io.IOException - if the file could not be read.
      • parseJavadocAsDetailNode

        public static DetailNode parseJavadocAsDetailNode​(DetailAST blockComment)
        Parse block comment DetailAST as Javadoc DetailNode tree.
        Parameters:
        blockComment - DetailAST
        Returns:
        DetailNode tree
      • parseJavadocAsDetailNode

        private static DetailNode parseJavadocAsDetailNode​(java.lang.String javadocComment)
        Parse javadoc comment to DetailNode tree.
        Parameters:
        javadocComment - javadoc comment content
        Returns:
        tree
      • getParseErrorMessage

        private static java.lang.String getParseErrorMessage​(JavadocDetailNodeParser.ParseErrorMessage parseErrorMessage)
        Builds error message base on ParseErrorMessage's message key, its arguments, etc.
        Parameters:
        parseErrorMessage - ParseErrorMessage
        Returns:
        error message
      • printTree

        public static java.lang.String printTree​(DetailNode ast,
                                                 java.lang.String rootPrefix,
                                                 java.lang.String prefix)
        Print AST.
        Parameters:
        ast - the root AST node.
        rootPrefix - prefix for the root node
        prefix - prefix for other nodes
        Returns:
        string AST.
      • getIndentation

        private static java.lang.String getIndentation​(DetailNode node)
        Get indentation for a node.
        Parameters:
        node - the DetailNode to get the indentation for.
        Returns:
        the indentation in String format.
      • parseFile

        private static DetailNode parseFile​(java.io.File file)
                                     throws java.io.IOException
        Parse a file and return the parse tree.
        Parameters:
        file - the file to parse.
        Returns:
        the root node of the parse tree.
        Throws:
        java.io.IOException - if the file could not be read.
      • createFakeBlockComment

        private static DetailAST createFakeBlockComment​(java.lang.String content)
        Creates DetailAST block comment to pass it to the Javadoc parser.
        Parameters:
        content - comment content.
        Returns:
        DetailAST block comment