Package com.thoughtworks.qdox.library
Interface ClassLibraryBuilder
-
- All Superinterfaces:
java.io.Serializable
- All Known Implementing Classes:
OrderedClassLibraryBuilder,SortedClassLibraryBuilder
public interface ClassLibraryBuilder extends java.io.SerializableThis 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: TheSortedClassLibraryBuilderbundles all classloaders, all sourcefolders and all sources. TheOrderedClassLibraryBuilderon the other hand keeps track of the order in which sourcetypes are added.- Since:
- 2.0
- Author:
- Robert Scholte
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description JavaSourceaddSource(java.io.File file)JavaSourceaddSource(java.io.InputStream stream)JavaSourceaddSource(java.io.Reader reader)Add the source content of the reader to the ClassLibrary and return the generated JavaSourceJavaSourceaddSource(java.net.URL url)JavaModuleaddSourceFolder(java.io.File sourceFolder)ClassLibraryBuilderappendClassLoader(java.lang.ClassLoader classLoader)Append a classloader and return itselfClassLibraryBuilderappendDefaultClassLoaders()Add the defaultClassLoaders and return itseClassLibraryBuilderappendSource(java.io.File file)ClassLibraryBuilderappendSource(java.io.InputStream stream)ClassLibraryBuilderappendSource(java.io.Reader reader)ClassLibraryBuilderappendSource(java.net.URL url)ClassLibraryBuilderappendSourceFolder(java.io.File sourceFolder)ClassLibrarygetClassLibrary()Get the library based on the strategy of the implementationClassLibraryBuildersetDebugLexer(boolean debugLexer)Set totrueto enable debug logging for the lexerClassLibraryBuildersetDebugParser(boolean debugParser)Set totrueto enable debug logging for the parserClassLibraryBuildersetEncoding(java.lang.String encoding)ClassLibraryBuildersetErrorHander(ErrorHandler errorHandler)Can handle ParseExceptions instead of crashing.ClassLibraryBuildersetModelBuilderFactory(ModelBuilderFactory factory)Define theModelBuilderFactorywhich the parsers should use to construct the JavaModel ObjectsClassLibraryBuildersetModelWriterFactory(ModelWriterFactory factory)Define theModelWriterFactorywhich is used by the classes when calling for the codeBlock.
-
-
-
Method Detail
-
appendClassLoader
ClassLibraryBuilder appendClassLoader(java.lang.ClassLoader classLoader)
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
ClassLibraryBuilder appendSourceFolder(java.io.File sourceFolder)
- Parameters:
sourceFolder- the source folder- Returns:
- this ClassLibraryBuilder instance
-
appendSource
ClassLibraryBuilder appendSource(java.io.InputStream stream) throws java.io.IOException
- Parameters:
stream- the Java source as stream- Returns:
- this ClassLibraryBuilder instance
- Throws:
java.io.IOException- if an IOException is thrown, e.g. unsupported encoding
-
appendSource
ClassLibraryBuilder appendSource(java.io.Reader reader)
- Parameters:
reader- the Java source as reader- Returns:
- this ClassLibraryBuilder instance
-
appendSource
ClassLibraryBuilder appendSource(java.net.URL url) throws java.io.IOException
- Parameters:
url- the Java source as URL- Returns:
- this ClassLibraryBuilder instance
- Throws:
java.io.IOException- if an IOException occurs
-
appendSource
ClassLibraryBuilder appendSource(java.io.File file) throws java.io.IOException
- Parameters:
file- the Java source as file- Returns:
- this ClassLibraryBuilder instance
- Throws:
java.io.IOException- if an IOException occurs
-
addSource
JavaSource addSource(java.io.InputStream stream) throws java.io.IOException
- Parameters:
stream- the Java source as stream- Returns:
- the created JavaSource
- Throws:
java.io.IOException- if an IOException is thrown, e.g. unsupported encoding
-
addSource
JavaSource addSource(java.io.Reader reader)
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
JavaSource addSource(java.net.URL url) throws java.io.IOException
- Parameters:
url- the Java source as URL- Returns:
- the created JavaSource
- Throws:
java.io.IOException- if an IOException occurs
-
addSource
JavaSource addSource(java.io.File file) throws java.io.IOException
- Parameters:
file- the Java source as file- Returns:
- the created JavaSource
- Throws:
java.io.IOException- if an IOException occurs
-
setDebugLexer
ClassLibraryBuilder setDebugLexer(boolean debugLexer)
Set totrueto enable debug logging for the lexer- Parameters:
debugLexer- the debug logging flag- Returns:
- this ClassLibraryBuilder instance
-
setDebugParser
ClassLibraryBuilder setDebugParser(boolean debugParser)
Set totrueto enable debug logging for the parser- Parameters:
debugParser- the debug logging flag- Returns:
- this ClassLibraryBuilder instance
-
setEncoding
ClassLibraryBuilder setEncoding(java.lang.String encoding)
- Parameters:
encoding- set the encoding- Returns:
- this ClassLibraryBuilder instance
-
setModelBuilderFactory
ClassLibraryBuilder setModelBuilderFactory(ModelBuilderFactory factory)
Define theModelBuilderFactorywhich the parsers should use to construct the JavaModel Objects- Parameters:
factory- the modelBuilderFactory- Returns:
- this ClassLibraryBuilder instance
-
setModelWriterFactory
ClassLibraryBuilder setModelWriterFactory(ModelWriterFactory factory)
Define theModelWriterFactorywhich 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
ClassLibraryBuilder setErrorHander(ErrorHandler errorHandler)
Can handle ParseExceptions instead of crashing. Has only effect on the appendSource() methods- Parameters:
errorHandler- the errorHandler- Returns:
- this ClassLibraryBuilder instance
-
addSourceFolder
JavaModule addSourceFolder(java.io.File sourceFolder)
- Parameters:
sourceFolder- the sourcefolder- Returns:
- the module info if the sourcefolder has a module-info.java, otherwise
null - Since:
- 2.0
-
-