|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ashridgetech.jamda.common.Scraper
A doclet which extracts the text of method bodies and field initial values.
The default action is to print the name, location and code for each method and field,
but a subclass may override the handleMethod(com.sun.javadoc.MethodDoc, java.lang.String)
and handleField(com.sun.javadoc.FieldDoc, java.lang.String)
methods
in order to deal with them differently.
The maximum source file size which may be handled is given by the constant MAX_FILE_SIZE
.
Field Summary | |
static char |
DOUBLE_QUOTE
|
static char |
EQUALS
|
static char |
LBRACE
|
static int |
MAX_FILE_SIZE
The maximum size of file which may be handled. |
static char |
RBRACE
|
static char |
SEMICOLON
|
static char |
SINGLE_QUOTE
|
Constructor Summary | |
Scraper(com.sun.javadoc.RootDoc root)
Construct a Scraper which will scrape from the classes
in root . |
Method Summary | |
protected java.lang.String |
extract(char startDelim,
char endDelim)
|
protected java.lang.String |
extractBody()
|
protected java.lang.String |
extractInitialValue()
|
com.sun.javadoc.RootDoc |
getRoot()
Get the root document with twhich this Scraper
was constructed. |
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. |
void |
scrape()
Perform the scraping process. |
void |
scrapeClass(com.sun.javadoc.ClassDoc doc)
Scrape information from one class. |
void |
scrapeConstructor(com.sun.javadoc.ConstructorDoc ctorDoc)
Scrape information for one constructor. |
void |
scrapeField(com.sun.javadoc.FieldDoc fieldDoc)
Scrape information for one field. |
void |
scrapeMethod(com.sun.javadoc.MethodDoc methodDoc)
Scrape information for one method. |
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final char LBRACE
public static final char RBRACE
public static final char EQUALS
public static final char SEMICOLON
public static final char SINGLE_QUOTE
public static final char DOUBLE_QUOTE
public static final int MAX_FILE_SIZE
Constructor Detail |
public Scraper(com.sun.javadoc.RootDoc root)
Scraper
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 com.sun.javadoc.RootDoc getRoot()
Scraper
was constructed.
public void scrape() throws java.lang.Exception
java.lang.Exception
public void scrapeClass(com.sun.javadoc.ClassDoc doc) throws java.lang.Exception
doc
- the Javadoc information for the class being scraped
java.io.IOException
- if there is a problem reading the code from the source file
java.lang.Exception
public void scrapeConstructor(com.sun.javadoc.ConstructorDoc ctorDoc) throws java.lang.Exception
java.io.IOException
- if there is a problem reading the code from the source file
java.lang.Exception
public void scrapeMethod(com.sun.javadoc.MethodDoc methodDoc) throws java.lang.Exception
methodDoc
- the Javadoc information for the method being scraped
java.io.IOException
- if there is a problem reading the code from the source file
java.lang.Exception
public void scrapeField(com.sun.javadoc.FieldDoc fieldDoc) throws java.lang.Exception
fieldDoc
- the Javadoc information for the field being scraped
java.io.IOException
- if there is a problem reading the code from the source file
java.lang.Exception
public static boolean validOptions(java.lang.String[][] options, com.sun.javadoc.DocErrorReporter reporter)
options
- the options to test
protected void handleConstructor(com.sun.javadoc.ConstructorDoc memberDoc, java.lang.String body) throws java.lang.Exception
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) throws java.lang.Exception
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.
java.lang.Exception
protected void handleField(com.sun.javadoc.FieldDoc fieldDoc, java.lang.String initValue) throws java.lang.Exception
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.
java.lang.Exception
protected java.lang.String extractBody() throws java.io.IOException
java.io.IOException
protected java.lang.String extractInitialValue() throws java.io.IOException
java.io.IOException
protected java.lang.String extract(char startDelim, char endDelim) throws java.io.IOException
java.io.IOException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |