com.thoughtworks.qdox
Class JavaDocBuilder

java.lang.Object
  extended bycom.thoughtworks.qdox.JavaDocBuilder
All Implemented Interfaces:
JavaClassCache, java.io.Serializable

public class JavaDocBuilder
extends java.lang.Object
implements java.io.Serializable, JavaClassCache

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
See Also:
Serialized Form

Constructor Summary
JavaDocBuilder()
           
JavaDocBuilder(DocletTagFactory docletTagFactory)
           
 
Method Summary
 JavaSource addSource(java.io.File file)
           
 JavaSource addSource(java.io.Reader reader)
           
 JavaSource addSource(java.io.Reader reader, java.lang.String sourceInfo)
           
 JavaSource addSource(java.net.URL url)
           
 void addSourceTree(java.io.File file)
           
 JavaClass getClassByName(java.lang.String name)
           
 JavaClass[] 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).
 ClassLibrary getClassLibrary()
           
 JavaSource[] getSources()
           
static JavaDocBuilder load(java.io.File file)
          Note that after loading JavaDocBuilder classloaders need to be re-added.
 void save(java.io.File file)
           
 java.util.List search(Searcher searcher)
           
 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(java.lang.String encoding)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaDocBuilder

public JavaDocBuilder()

JavaDocBuilder

public JavaDocBuilder(DocletTagFactory docletTagFactory)
Method Detail

getClassByName

public JavaClass getClassByName(java.lang.String name)
Specified by:
getClassByName in interface JavaClassCache

addSource

public JavaSource addSource(java.io.Reader reader)

addSource

public JavaSource addSource(java.io.Reader reader,
                            java.lang.String sourceInfo)

addSource

public JavaSource addSource(java.io.File file)
                     throws java.io.IOException,
                            java.io.FileNotFoundException
Throws:
java.io.IOException
java.io.FileNotFoundException

addSource

public JavaSource addSource(java.net.URL url)
                     throws java.io.IOException,
                            java.io.FileNotFoundException
Throws:
java.io.IOException
java.io.FileNotFoundException

getSources

public JavaSource[] getSources()

getClasses

public JavaClass[] 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).

Specified by:
getClasses in interface JavaClassCache
Returns:
all the classes found in all the sources.
Since:
1.3

addSourceTree

public void addSourceTree(java.io.File file)

search

public java.util.List search(Searcher searcher)

getClassLibrary

public ClassLibrary getClassLibrary()

save

public void save(java.io.File file)
          throws java.io.IOException
Throws:
java.io.IOException

load

public static JavaDocBuilder load(java.io.File file)
                           throws java.io.IOException
Note that after loading JavaDocBuilder classloaders need to be re-added.

Throws:
java.io.IOException

setEncoding

public void setEncoding(java.lang.String encoding)

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.



Copyright © 2002-2007 ThoughtWorks, Inc. All Rights Reserved.