Package com.thoughtworks.qdox
Class JavaDocBuilder
java.lang.Object
com.thoughtworks.qdox.JavaDocBuilder
- All Implemented Interfaces:
Serializable
Simple facade to QDox allowing a source tree to be parsed and the resulting object model navigated.
Example
// -- Create JavaDocBuilder
JavaDocBuilder builder = new JavaDocBuilder();
// -- Add some files
// Reading a single source file.
builder.addSource(new FileReader("MyFile.java"));
// Reading from another kind of input stream.
builder.addSource(new StringReader("package test; public class Hello {}"));
// Adding all .java files in a source tree (recursively).
builder.addSourceTree(new File("mysrcdir"));
// -- Retrieve source files
JavaSource[] source = builder.getSources();
- Author:
- Joe Walnes, Aslak Hellesøy, Robert Scholte
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static interface
-
Constructor Summary
ConstructorsConstructorDescriptionJavaDocBuilder
(ClassLibrary classLibrary) JavaDocBuilder
(DocletTagFactory docletTagFactory) JavaDocBuilder
(DocletTagFactory docletTagFactory, ClassLibrary classLibrary) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addSourceTree
(File file) Add all files in a directory (and subdirs, recursively).void
addSourceTree
(File file, FileVisitor errorHandler) Add all files in a directory (and subdirs, recursively).protected JavaClass
createBinaryClass
(String name) protected JavaClass
createSourceClass
(String name) protected JavaClass
createUnknownClass
(String name) getClassByName
(String name) Returns all the classes found in all the sources, including inner classes and "extra" classes (multiple outer classes defined in the same source file).getPackageByName
(String name) Returns all the packages found in all the sources.static JavaDocBuilder
Note that after loading JavaDocBuilder classloaders need to be re-added.void
void
setDebugLexer
(boolean debugLexer) Forces QDox to dump tokens returned from lexer to System.err.void
setDebugParser
(boolean debugParser) Forces QDox to dump parser states to System.out.void
setEncoding
(String encoding) void
setErrorHandler
(JavaDocBuilder.ErrorHandler errorHandler)
-
Constructor Details
-
JavaDocBuilder
public JavaDocBuilder() -
JavaDocBuilder
-
JavaDocBuilder
-
JavaDocBuilder
-
-
Method Details
-
getClassByName
-
createSourceClass
-
createUnknownClass
-
createBinaryClass
-
addSource
-
addSource
-
addSource
- Throws:
IOException
FileNotFoundException
-
addSource
- Throws:
IOException
FileNotFoundException
-
setErrorHandler
-
getSources
-
getClasses
Returns all the classes found in all the sources, including inner classes and "extra" classes (multiple outer classes defined in the same source file).- Returns:
- all the classes found in all the sources.
- Since:
- 1.3
-
getPackages
Returns all the packages found in all the sources.- Returns:
- all the packages found in all the sources.
- Since:
- 1.9
-
addSourceTree
Add all files in a directory (and subdirs, recursively). If a file cannot be read, a RuntimeException shall be thrown. -
addSourceTree
Add all files in a directory (and subdirs, recursively). If a file cannot be read, errorHandler will be notified. -
search
-
getClassLibrary
-
save
- Throws:
IOException
-
load
Note that after loading JavaDocBuilder classloaders need to be re-added.- Throws:
IOException
-
setEncoding
-
setDebugLexer
public void setDebugLexer(boolean debugLexer) Forces QDox to dump tokens returned from lexer to System.err. -
setDebugParser
public void setDebugParser(boolean debugParser) Forces QDox to dump parser states to System.out. -
getPackageByName
-