Class Javadoc

    • Field Detail

      • m_StartTag

        protected String[] m_StartTag
        the start tag.
      • m_EndTag

        protected String[] m_EndTag
        the end tag.
      • m_IsBlock

        protected boolean[] m_IsBlock
        whether to use identation.
      • m_Classname

        protected String m_Classname
        the classname.
      • m_UseStars

        protected boolean m_UseStars
        whether to include the stars in the Javadoc.
      • m_Dir

        protected String m_Dir
        the directory above the class to update.
      • m_Silent

        protected boolean m_Silent
        whether to suppress error messages (no printout in the console).
      • m_Environment

        protected String m_Environment
        the environment class (dummy option, happens all in runJavadoc method).
      • m_UserMode

        protected UserMode m_UserMode
        the user mode to generate the javadoc for.
      • m_OptionManager

        protected OptionManager m_OptionManager
        for managing the available options.
    • Constructor Detail

      • Javadoc

        public Javadoc()
        Initializes the object, sets default options.
    • Method Detail

      • initialize

        protected void initialize()
        Initializes the members.
      • newOptionManager

        protected OptionManager newOptionManager()
        Returns a new instance of the option manager.
        Returns:
        the manager to use
      • defineOptions

        public void defineOptions()
        Adds options to the internal list of options. Derived classes must override this method to add additional options.
        Specified by:
        defineOptions in interface OptionHandler
      • destroy

        public void destroy()
        Frees up memory in a "destructive" non-reversible way.

        Cleans up the options.
        Specified by:
        destroy in interface Destroyable
        See Also:
        cleanUpOptions()
      • setEnvironment

        public void setEnvironment​(String value)
        sets the classname of the environment class to use.
        Parameters:
        value - the environment class name
      • getEnvironment

        public String getEnvironment()
        returns the current classname of the environment class to use.
        Returns:
        the current classname of the environment class
      • environmentTipText

        public String environmentTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setClassname

        public void setClassname​(String value)
        sets the classname of the class to generate the Javadoc for.
        Parameters:
        value - the new classname
      • getClassname

        public String getClassname()
        returns the current classname.
        Returns:
        the current classname
      • classnameTipText

        public String classnameTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setUseStars

        public void setUseStars​(boolean value)
        sets whether to prefix the Javadoc with "*".
        Parameters:
        value - true if stars are used
      • getUseStars

        public boolean getUseStars()
        whether the Javadoc is prefixed with "*".
        Returns:
        whether stars are used
      • useStarsTipText

        public String useStarsTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setDir

        public void setDir​(String value)
        sets the dir containing the file that is to be updated. It is the dir above the package hierarchy of the class.
        Parameters:
        value - the directory containing the classes
      • getDir

        public String getDir()
        returns the current dir containing the class to update. It is the dir above the package name of the class.
        Returns:
        the current directory
      • dirTipText

        public String dirTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setSilent

        public void setSilent​(boolean value)
        sets whether to suppress output in the console.
        Parameters:
        value - true if output is to be suppressed
      • getSilent

        public boolean getSilent()
        whether output in the console is suppressed.
        Returns:
        true if output is suppressed
      • silentTipText

        public String silentTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setUserMode

        public void setUserMode​(UserMode value)
        Sets the user mode to pass on to the producer if that supports it.
        Specified by:
        setUserMode in interface UserModeSupporter
        Parameters:
        value - the user mode
      • getUserMode

        public UserMode getUserMode()
        Returns the user mode to pass on to the producer if that supports it.
        Specified by:
        getUserMode in interface UserModeSupporter
        Returns:
        the user mode
      • userModeTipText

        public String userModeTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • println

        protected void println​(Object o)
        prints the given object to System.err.
        Parameters:
        o - the object to print
      • canInstantiateClass

        protected boolean canInstantiateClass()
        returns true if the class can be instantiated, i.e., has a default constructor.
        Returns:
        true if the class can be instantiated
      • getInstance

        protected Object getInstance()
        Returns a new instance of the class.
        Returns:
        a new instance of the class
      • toHTML

        protected String toHTML​(String s)
        converts the given String into HTML, i.e., replacing some char entities with HTML entities.
        Parameters:
        s - the string to convert
        Returns:
        the HTML conform string
      • indent

        protected String indent​(String content,
                                int count,
                                String indentStr)
        indents the given string by a given number of indention strings.
        Parameters:
        content - the string to indent
        count - the number of times to indent one line
        indentStr - the indention string
        Returns:
        the indented content
      • generateJavadoc

        protected abstract String generateJavadoc​(int index)
                                           throws Exception
        generates and returns the Javadoc for the specified start/end tag pair.
        Parameters:
        index - the index in the start/end tag array
        Returns:
        the generated Javadoc
        Throws:
        Exception - in case the generation fails
      • generateJavadoc

        protected String generateJavadoc()
                                  throws Exception
        generates and returns the Javadoc.
        Returns:
        the generated Javadoc
        Throws:
        Exception - in case the generation fails
      • getIndentionString

        protected String getIndentionString​(String str)
        determines the base string of the given indention string, whether it's either only spaces (one space will be retured) or mixed mode (tabs and spaces, in that case the same string will be returned).
        Parameters:
        str - the string to analyze
        Returns:
        the indention string
      • getIndentionLength

        protected int getIndentionLength​(String str)
        determines the number of indention strings that have to be inserted to generated the given indention string.
        Parameters:
        str - the string to analyze
        Returns:
        the number of base indention strings to insert
      • updateJavadoc

        protected String updateJavadoc​(String content,
                                       int index)
                                throws Exception
        generates and returns the Javadoc for the specified start/end tag pair.
        Parameters:
        content - the current source code
        index - the index in the start/end tag array
        Returns:
        the generated Javadoc
        Throws:
        Exception - in case the generation fails
      • updateJavadoc

        protected String updateJavadoc​(String content)
                                throws Exception
        updates the Javadoc in the given source code.
        Parameters:
        content - the source code
        Returns:
        the updated source code
        Throws:
        Exception - in case the generation fails
      • updateJavadoc

        public String updateJavadoc()
                             throws Exception
        generates the Javadoc and returns it applied to the source file if one was provided, otherwise an empty string.
        Returns:
        the generated Javadoc
        Throws:
        Exception - in case the generation fails
      • generate

        public String generate()
                        throws Exception
        generates either the plain Javadoc (if no filename specified) or the updated file (if a filename is specified). The start and end tag for the global info have to be specified in the file in the latter case.
        Returns:
        either the plain Javadoc or the modified file
        Throws:
        Exception - in case the generation fails
      • toString

        public String toString()
        Returns the commandline of this object.
        Overrides:
        toString in class Object
        Returns:
        the commandline
      • toCommandLine

        public String toCommandLine()
        Returns the commandline string.
        Specified by:
        toCommandLine in interface OptionHandler
        Returns:
        the commandline
      • forName

        public static Javadoc forName​(String classname,
                                      String[] options)
        Instantiates the javadoc generator with the given options.
        Parameters:
        classname - the classname of the javadoc generator to instantiate
        options - the options for the javadoc generator
        Returns:
        the instantiated javadoc generator or null if an error occurred
      • forCommandLine

        public static Javadoc forCommandLine​(String cmdline)
        Instantiates the javadoc generator from the given commandline (i.e., classname and optional options).
        Parameters:
        cmdline - the classname (and optional options) of the javadoc generator to instantiate
        Returns:
        the instantiated javadoc generator or null if an error occurred
      • runJavadoc

        public static void runJavadoc​(Class javadoc,
                                      String[] options)
        runs the javadoc producer with the given commandline options.
        Parameters:
        javadoc - the javadoc producer to execute
        options - the commandline options
      • getJavadocs

        public static String[] getJavadocs()
        Returns a list with classnames of Javadoc generators.
        Returns:
        the classnames