Package com.thoughtworks.qdox.library
Class ClassLoaderLibrary
- java.lang.Object
-
- com.thoughtworks.qdox.library.AbstractClassLibrary
-
- com.thoughtworks.qdox.library.ClassLoaderLibrary
-
- All Implemented Interfaces:
ClassLibrary
,java.io.Serializable
public class ClassLoaderLibrary extends AbstractClassLibrary
Important!! Be sure to add a classloader with the bootstrap classes.Normally you can generate your classLibrary like this:
ClassLibrary classLibrary = new ClassLibrary(); classLibrary.addDefaultLoader();
If you want full control over the classLoaders you might want to create your library like:
ClassLibrary classLibrary = new ClassLibrary( ClassLoader.getSystemClassLoader() )
- Since:
- 2.0
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.thoughtworks.qdox.library.AbstractClassLibrary
AbstractClassLibrary.ClassLibraryFilter
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<java.lang.ClassLoader>
classLoaders
private boolean
debugLexer
private boolean
debugParser
private boolean
defaultClassLoadersAdded
private ErrorHandler
errorHandler
-
Constructor Summary
Constructors Constructor Description ClassLoaderLibrary(AbstractClassLibrary parent)
ClassLoaderLibrary(AbstractClassLibrary parent, java.lang.ClassLoader classLoader)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addClassLoader(java.lang.ClassLoader classLoader)
void
addDefaultLoader()
protected boolean
containsClassReference(java.lang.String name)
This method is used to detect if there's a match with this classname.private void
readObject(java.io.ObjectInputStream in)
protected JavaClass
resolveJavaClass(java.lang.String name)
The implementation should check it's sources to see if it can build a JavaClass Model If not, just return null; Once found it will be mapped, so there's no need to keep a reference to this object.protected JavaPackage
resolveJavaPackage(java.lang.String name)
void
setDebugLexer(boolean debugLexer)
Set totrue
to enable debug logging for the lexervoid
setDebugParser(boolean debugParser)
Set totrue
to enable debug logging for the parservoid
setErrorHandler(ErrorHandler errorHandler)
-
Methods inherited from class com.thoughtworks.qdox.library.AbstractClassLibrary
getJavaClass, getJavaClass, getJavaClasses, getJavaClasses, getJavaModules, getJavaPackage, getJavaPackages, getJavaPackages, getJavaSources, getJavaSources, getModelBuilder, getModelBuilder, getModelBuilderFactory, getModelWriterFactory, hasClassReference, setModelBuilderFactory, setModelWriterFactory
-
-
-
-
Field Detail
-
classLoaders
private transient java.util.List<java.lang.ClassLoader> classLoaders
-
defaultClassLoadersAdded
private boolean defaultClassLoadersAdded
-
debugLexer
private boolean debugLexer
-
debugParser
private boolean debugParser
-
errorHandler
private ErrorHandler errorHandler
-
-
Constructor Detail
-
ClassLoaderLibrary
public ClassLoaderLibrary(AbstractClassLibrary parent)
-
ClassLoaderLibrary
public ClassLoaderLibrary(AbstractClassLibrary parent, java.lang.ClassLoader classLoader)
-
-
Method Detail
-
addClassLoader
public void addClassLoader(java.lang.ClassLoader classLoader)
-
addDefaultLoader
public void addDefaultLoader()
-
resolveJavaClass
protected JavaClass resolveJavaClass(java.lang.String name)
Description copied from class:AbstractClassLibrary
The implementation should check it's sources to see if it can build a JavaClass Model If not, just return null; Once found it will be mapped, so there's no need to keep a reference to this object.- Specified by:
resolveJavaClass
in classAbstractClassLibrary
- Parameters:
name
- the fully qualified name- Returns:
- the resolved JavaClass, otherwise
null
-
resolveJavaPackage
protected JavaPackage resolveJavaPackage(java.lang.String name)
- Specified by:
resolveJavaPackage
in classAbstractClassLibrary
-
readObject
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
- Throws:
java.io.IOException
java.lang.ClassNotFoundException
-
containsClassReference
protected boolean containsClassReference(java.lang.String name)
Description copied from class:AbstractClassLibrary
This method is used to detect if there's a match with this classname. The name could be constructed based on imports and inner class paths.- Specified by:
containsClassReference
in classAbstractClassLibrary
- Parameters:
name
- the fully qualified name of the class- Returns:
- true if this ClassLibrary has a reference to this class.
-
setDebugLexer
public void setDebugLexer(boolean debugLexer)
Set totrue
to enable debug logging for the lexer- Parameters:
debugLexer
- the debug logging flag
-
setDebugParser
public void setDebugParser(boolean debugParser)
Set totrue
to enable debug logging for the parser- Parameters:
debugParser
- the debug logging flag
-
setErrorHandler
public void setErrorHandler(ErrorHandler errorHandler)
-
-