Package com.thoughtworks.qdox.library
Interface ClassLibraryBuilder
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
OrderedClassLibraryBuilder
,SortedClassLibraryBuilder
This builder helps to construct a library.
All kinds of sourcetypes are supported and it's up to the implementation how to bind these types.
For instance: The
SortedClassLibraryBuilder
bundles all classloaders, all sourcefolders and all sources.
The OrderedClassLibraryBuilder
on the other hand keeps track of the order in which sourcetypes are added.- Since:
- 2.0
-
Method Summary
Modifier and TypeMethodDescriptionaddSource
(InputStream stream) Add the source content of the reader to the ClassLibrary and return the generated JavaSourceaddSourceFolder
(File sourceFolder) appendClassLoader
(ClassLoader classLoader) Append a classloader and return itselfAdd the defaultClassLoaders and return itseappendSource
(File file) appendSource
(InputStream stream) appendSource
(Reader reader) appendSource
(URL url) appendSourceFolder
(File sourceFolder) Get the library based on the strategy of the implementationsetDebugLexer
(boolean debugLexer) Set totrue
to enable debug logging for the lexersetDebugParser
(boolean debugParser) Set totrue
to enable debug logging for the parsersetEncoding
(String encoding) setErrorHander
(ErrorHandler errorHandler) Can handle ParseExceptions instead of crashing.Define theModelBuilderFactory
which the parsers should use to construct the JavaModel ObjectssetModelWriterFactory
(ModelWriterFactory factory) Define theModelWriterFactory
which is used by the classes when calling for the codeBlock.
-
Method Details
-
appendClassLoader
Append a classloader and return itself- Parameters:
classLoader
- the classloader to add- Returns:
- this ClassLibraryBuilder instance
-
appendDefaultClassLoaders
ClassLibraryBuilder appendDefaultClassLoaders()Add the defaultClassLoaders and return itse- Returns:
- this ClassLibraryBuilder instance
-
appendSourceFolder
- Parameters:
sourceFolder
- the source folder- Returns:
- this ClassLibraryBuilder instance
-
appendSource
- Parameters:
stream
- the Java source as stream- Returns:
- this ClassLibraryBuilder instance
- Throws:
IOException
- if an IOException is thrown, e.g. unsupported encoding
-
appendSource
- Parameters:
reader
- the Java source as reader- Returns:
- this ClassLibraryBuilder instance
-
appendSource
- Parameters:
url
- the Java source as URL- Returns:
- this ClassLibraryBuilder instance
- Throws:
IOException
- if an IOException occurs
-
appendSource
- Parameters:
file
- the Java source as file- Returns:
- this ClassLibraryBuilder instance
- Throws:
IOException
- if an IOException occurs
-
addSource
- Parameters:
stream
- the Java source as stream- Returns:
- the created JavaSource
- Throws:
IOException
- if an IOException is thrown, e.g. unsupported encoding
-
addSource
Add the source content of the reader to the ClassLibrary and return the generated JavaSource- Parameters:
reader
- the Java source as reader- Returns:
- the created JavaSource
-
addSource
- Parameters:
url
- the Java source as URL- Returns:
- the created JavaSource
- Throws:
IOException
- if an IOException occurs
-
addSource
- Parameters:
file
- the Java source as file- Returns:
- the created JavaSource
- Throws:
IOException
- if an IOException occurs
-
setDebugLexer
Set totrue
to enable debug logging for the lexer- Parameters:
debugLexer
- the debug logging flag- Returns:
- this ClassLibraryBuilder instance
-
setDebugParser
Set totrue
to enable debug logging for the parser- Parameters:
debugParser
- the debug logging flag- Returns:
- this ClassLibraryBuilder instance
-
setEncoding
- Parameters:
encoding
- set the encoding- Returns:
- this ClassLibraryBuilder instance
-
setModelBuilderFactory
Define theModelBuilderFactory
which the parsers should use to construct the JavaModel Objects- Parameters:
factory
- the modelBuilderFactory- Returns:
- this ClassLibraryBuilder instance
-
setModelWriterFactory
Define theModelWriterFactory
which is used by the classes when calling for the codeBlock.- Parameters:
factory
- the modelWriterFactory- Returns:
- this ClassLibraryBuilder instance
-
getClassLibrary
ClassLibrary getClassLibrary()Get the library based on the strategy of the implementation- Returns:
- the constructed ClassLibrary
-
setErrorHander
Can handle ParseExceptions instead of crashing. Has only effect on the appendSource() methods- Parameters:
errorHandler
- the errorHandler- Returns:
- this ClassLibraryBuilder instance
-
addSourceFolder
- Parameters:
sourceFolder
- the sourcefolder- Returns:
- the module info if the sourcefolder has a module-info.java, otherwise
null
- Since:
- 2.0
-