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 classstatic interface -
Constructor Summary
ConstructorsConstructorDescriptionJavaDocBuilder(ClassLibrary classLibrary) JavaDocBuilder(DocletTagFactory docletTagFactory) JavaDocBuilder(DocletTagFactory docletTagFactory, ClassLibrary classLibrary) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSourceTree(File file) Add all files in a directory (and subdirs, recursively).voidaddSourceTree(File file, FileVisitor errorHandler) Add all files in a directory (and subdirs, recursively).protected JavaClasscreateBinaryClass(String name) protected JavaClasscreateSourceClass(String name) protected JavaClasscreateUnknownClass(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 JavaDocBuilderNote that after loading JavaDocBuilder classloaders need to be re-added.voidvoidsetDebugLexer(boolean debugLexer) Forces QDox to dump tokens returned from lexer to System.err.voidsetDebugParser(boolean debugParser) Forces QDox to dump parser states to System.out.voidsetEncoding(String encoding) voidsetErrorHandler(JavaDocBuilder.ErrorHandler errorHandler)
-
Constructor Details
-
JavaDocBuilder
public JavaDocBuilder() -
JavaDocBuilder
-
JavaDocBuilder
-
JavaDocBuilder
-
-
Method Details
-
getClassByName
-
createSourceClass
-
createUnknownClass
-
createBinaryClass
-
addSource
-
addSource
-
addSource
- Throws:
IOExceptionFileNotFoundException
-
addSource
- Throws:
IOExceptionFileNotFoundException
-
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
-