public abstract class Javadoc extends Object implements OptionHandler, RevisionHandler
Modifier and Type | Field and Description |
---|---|
protected String |
m_Classname
the classname
|
protected String |
m_Dir
the directory above the class to update
|
protected String[] |
m_EndTag
the end tag
|
protected boolean |
m_Silent
whether to suppress error messages (no printout in the console)
|
protected String[] |
m_StartTag
the start tag
|
protected boolean |
m_UseStars
whether to include the stars in the Javadoc
|
Constructor and Description |
---|
Javadoc() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
canInstantiateClass()
returns true if the class can be instantiated, i.e., has a default
constructor.
|
String |
generate()
generates either the plain Javadoc (if no filename specified) or the
updated file (if a filename is specified).
|
String |
generateHelp()
generates a string to print as help on the console
|
protected String |
generateJavadoc()
generates and returns the Javadoc
|
protected abstract String |
generateJavadoc(int index)
generates and returns the Javadoc for the specified start/end tag pair.
|
String |
getClassname()
returns the current classname
|
String |
getDir()
returns the current dir containing the class to update.
|
protected int |
getIndentionLength(String str)
determines the number of indention strings that have to be inserted to
generated the given indention string.
|
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)
|
protected Object |
getInstance()
Returns a new instance of the class
|
String[] |
getOptions()
Gets the current settings of this object.
|
boolean |
getSilent()
whether output in the console is suppressed
|
boolean |
getUseStars()
whether the Javadoc is prefixed with "*"
|
protected String |
indent(String content,
int count,
String indentStr)
indents the given string by a given number of indention strings
|
Enumeration |
listOptions()
Returns an enumeration describing the available options.
|
protected void |
println(Object o)
prints the given object to System.err
|
protected static void |
runJavadoc(Javadoc javadoc,
String[] options)
runs the javadoc producer with the given commandline options
|
void |
setClassname(String value)
sets the classname of the class to generate the Javadoc for
|
void |
setDir(String value)
sets the dir containing the file that is to be updated.
|
void |
setOptions(String[] options)
Parses a given list of options.
|
void |
setSilent(boolean value)
sets whether to suppress output in the console
|
void |
setUseStars(boolean value)
sets whether to prefix the Javadoc with "*"
|
protected String |
toHTML(String s)
converts the given String into HTML, i.e., replacing some char entities
with HTML entities.
|
String |
updateJavadoc()
generates the Javadoc and returns it applied to the source file if one
was provided, otherwise an empty string.
|
protected String |
updateJavadoc(String content)
updates the Javadoc in the given source code.
|
protected String |
updateJavadoc(String content,
int index)
generates and returns the Javadoc for the specified start/end tag pair
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getRevision
protected String[] m_StartTag
protected String[] m_EndTag
protected String m_Classname
protected boolean m_UseStars
protected String m_Dir
protected boolean m_Silent
public Enumeration listOptions()
listOptions
in interface OptionHandler
public void setOptions(String[] options) throws Exception
setOptions
in interface OptionHandler
options
- the list of options as an array of stringsException
- if an option is not supportedpublic String[] getOptions()
getOptions
in interface OptionHandler
public void setClassname(String value)
value
- the new classnamepublic String getClassname()
public void setUseStars(boolean value)
value
- true if stars are usedpublic boolean getUseStars()
public void setDir(String value)
value
- the directory containing the classespublic String getDir()
public void setSilent(boolean value)
value
- true if output is to be suppressedpublic boolean getSilent()
protected void println(Object o)
o
- the object to printprotected boolean canInstantiateClass()
protected Object getInstance()
protected String toHTML(String s)
s
- the string to convertprotected String indent(String content, int count, String indentStr)
content
- the string to indentcount
- the number of times to indent one lineindentStr
- the indention stringprotected abstract String generateJavadoc(int index) throws Exception
index
- the index in the start/end tag arrayException
- in case the generation failsprotected String generateJavadoc() throws Exception
Exception
- in case the generation failsprotected String getIndentionString(String str)
str
- the string to analyzeprotected int getIndentionLength(String str)
str
- the string to analyzeprotected String updateJavadoc(String content, int index) throws Exception
content
- the current source codeindex
- the index in the start/end tag arrayException
- in case the generation failsprotected String updateJavadoc(String content) throws Exception
content
- the source codeException
- in case the generation failspublic String updateJavadoc() throws Exception
Exception
- in case the generation failspublic String generate() throws Exception
Exception
- in case the generation failspublic String generateHelp()
Copyright © 2015 University of Waikato, Hamilton, NZ. All rights reserved.