|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ashridgetech.jamda.common.Scraper | +--com.ashridgetech.jamda.common.XmlScraper
A doclet which extracts the text of method bodies and field initial values, and places the text in an XML file. The XML has the following format:
<codeElements> <method name="com.ashridgetech.jamda.common.Scraper.scrapeClass(com.sun.javadoc.ClassDoc)" > <![CDATA[ System.out.println( "Class: " + doc ); SourcePosition pos = doc.position(); fileName = pos.file().getPath(); ]]> </method> <field name="com.ashridgetech.jamda.common.Scraper.LBRACE"> <![CDATA['{']]> </field> </codeElements>For abstract methods or fields with no initialiser the following format is used:
<codeElements> <method name="com.ashridgetech.jamda.common.Scraper.scrapeMethod(com.sun.javadoc.ClassDoc)" abstract="true"/> <field name="com.ashridgetech.jamda.common.Scraper.elements" noInit="true"/> </codeElements>No DTD is currently defined for this file - the elements shown above are the only ones used.
Field Summary | |
static java.lang.String |
OUTPUT_FILE_OPTION
The command line option for the output file. |
Fields inherited from class com.ashridgetech.jamda.common.Scraper |
DOUBLE_QUOTE, EQUALS, LBRACE, MAX_FILE_SIZE, RBRACE, SEMICOLON, SINGLE_QUOTE |
Constructor Summary | |
XmlScraper(com.sun.javadoc.RootDoc root)
Construct a XmlScraper which will scrape from the classes
in root . |
Method Summary | |
protected void |
handleConstructor(com.sun.javadoc.ConstructorDoc memberDoc,
java.lang.String body)
Use the body code scraped for one constructor. |
protected void |
handleField(com.sun.javadoc.FieldDoc fieldDoc,
java.lang.String initValue)
Use the body code scraped for one field. |
protected void |
handleMethod(com.sun.javadoc.MethodDoc memberDoc,
java.lang.String body)
Use the body code scraped for one method. |
static int |
optionLength(java.lang.String option)
Doclet API method to allow recognition of the OUTPUT_FILE_OPTION command-line option |
void |
scrape()
Perform the scraping process. |
static boolean |
start(com.sun.javadoc.RootDoc root)
The standard method which must be provided by a doclet. |
static boolean |
validOptions(java.lang.String[][] options,
com.sun.javadoc.DocErrorReporter reporter)
Doclet API method to validate option usage. |
Methods inherited from class com.ashridgetech.jamda.common.Scraper |
extract, extractBody, extractInitialValue, getRoot, scrapeClass, scrapeConstructor, scrapeField, scrapeMethod |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String OUTPUT_FILE_OPTION
Constructor Detail |
public XmlScraper(com.sun.javadoc.RootDoc root)
XmlScraper
which will scrape from the classes
in root
.
root
- the root of the Javadoc information passed to the docletMethod Detail |
public static boolean start(com.sun.javadoc.RootDoc root)
root
- the root of the Javadoc information passed to the doclet
public void scrape() throws java.lang.Exception
scrape
in class Scraper
java.lang.Exception
protected void handleConstructor(com.sun.javadoc.ConstructorDoc memberDoc, java.lang.String body) throws java.lang.Exception
com.ashridgetech.jamda.common.XmlScraper.XmlScraper
.
Ignores default constructors created by the compiler.
handleConstructor
in class Scraper
memberDoc
- the Javadoc information for the constructor being scrapedbody
- the code for the constructor body, including whitespace, but excluding
the opening and closing braces.
java.lang.Exception
protected void handleMethod(com.sun.javadoc.MethodDoc memberDoc, java.lang.String body)
handleMethod
in class Scraper
memberDoc
- the Javadoc information for the method being scrapedbody
- the code for the method body, including whitespace, but excluding
the opening and closing braces. Will be null if the method has no body.protected void handleField(com.sun.javadoc.FieldDoc fieldDoc, java.lang.String initValue)
handleField
in class Scraper
fieldDoc
- the Javadoc information for the field being scrapedinitValue
- the code for the initialiser, trimmed of leading and trailing
whitespace, and excluding
the opening '=' and closing semicolon. Will be null if there is no initial value.public static int optionLength(java.lang.String option)
OUTPUT_FILE_OPTION
command-line option
option
- the option name to test
OUTPUT_FILE_OPTION
, 0 for any other tagpublic static boolean validOptions(java.lang.String[][] options, com.sun.javadoc.DocErrorReporter reporter)
OUTPUT_FILE_OPTION
command-line option,
as well as the checks made by the superclass method Scraper.validOptions(java.lang.String[][], com.sun.javadoc.DocErrorReporter)
.
options
- the options to test
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |