com.thoughtworks.qdox
Class JavaDocBuilder
java.lang.Object
com.thoughtworks.qdox.JavaDocBuilder
- All Implemented Interfaces:
- JavaClassCache, Serializable
- public class JavaDocBuilder
- extends Object
- implements 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
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JavaDocBuilder
public JavaDocBuilder()
JavaDocBuilder
public JavaDocBuilder(DocletTagFactory docletTagFactory)
getClassByName
public JavaClass getClassByName(String name)
- Specified by:
getClassByName
in interface JavaClassCache
addSource
public JavaSource addSource(Reader reader)
addSource
public JavaSource addSource(File file)
throws UnsupportedEncodingException,
FileNotFoundException
- Throws:
UnsupportedEncodingException
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).
- Returns:
- all the classes found in all the sources.
- Since:
- 1.3
addSourceTree
public void addSourceTree(File file)
search
public List search(Searcher searcher)
getClassLibrary
public ClassLibrary getClassLibrary()
save
public void save(File file)
throws IOException
- Throws:
IOException
load
public static JavaDocBuilder load(File file)
throws IOException
- Note that after loading JavaDocBuilder classloaders need to be re-added.
- Throws:
IOException
setEncoding
public void setEncoding(String encoding)
Copyright © 2002-2003 ThoughtWorks, Inc. All Rights Reserved.