Package com.thoughtworks.qdox.library
Class SortedClassLibraryBuilder
- java.lang.Object
-
- com.thoughtworks.qdox.library.SortedClassLibraryBuilder
-
- All Implemented Interfaces:
ClassLibraryBuilder,java.io.Serializable
public class SortedClassLibraryBuilder extends java.lang.Object implements ClassLibraryBuilder
- Since:
- 2.0
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private ClassLoaderLibraryclassLoaderLibraryprivate ClassNameLibraryclassNameLibraryprivate SourceFolderLibrarysourceFolderLibraryprivate SourceLibrarysourceLibrary
-
Constructor Summary
Constructors Constructor Description SortedClassLibraryBuilder()
-
Method Summary
All Methods Instance Methods Concrete 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 modelWriterFactory)Define theModelWriterFactorywhich is used by the classes when calling for the codeBlock.
-
-
-
Field Detail
-
classNameLibrary
private final ClassNameLibrary classNameLibrary
-
classLoaderLibrary
private final ClassLoaderLibrary classLoaderLibrary
-
sourceFolderLibrary
private final SourceFolderLibrary sourceFolderLibrary
-
sourceLibrary
private final SourceLibrary sourceLibrary
-
-
Method Detail
-
appendClassLoader
public ClassLibraryBuilder appendClassLoader(java.lang.ClassLoader classLoader)
Description copied from interface:ClassLibraryBuilderAppend a classloader and return itself- Specified by:
appendClassLoaderin interfaceClassLibraryBuilder- Parameters:
classLoader- the classloader to add- Returns:
- this ClassLibraryBuilder instance
-
appendDefaultClassLoaders
public ClassLibraryBuilder appendDefaultClassLoaders()
Description copied from interface:ClassLibraryBuilderAdd the defaultClassLoaders and return itse- Specified by:
appendDefaultClassLoadersin interfaceClassLibraryBuilder- Returns:
- this ClassLibraryBuilder instance
-
appendSourceFolder
public ClassLibraryBuilder appendSourceFolder(java.io.File sourceFolder)
- Specified by:
appendSourceFolderin interfaceClassLibraryBuilder- Parameters:
sourceFolder- the source folder- Returns:
- this ClassLibraryBuilder instance
-
appendSource
public ClassLibraryBuilder appendSource(java.io.InputStream stream) throws java.io.IOException
- Specified by:
appendSourcein interfaceClassLibraryBuilder- 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
public ClassLibraryBuilder appendSource(java.io.Reader reader)
- Specified by:
appendSourcein interfaceClassLibraryBuilder- Parameters:
reader- the Java source as reader- Returns:
- this ClassLibraryBuilder instance
-
appendSource
public ClassLibraryBuilder appendSource(java.net.URL url) throws java.io.IOException
- Specified by:
appendSourcein interfaceClassLibraryBuilder- Parameters:
url- the Java source as URL- Returns:
- this ClassLibraryBuilder instance
- Throws:
java.io.IOException- if an IOException occurs
-
appendSource
public ClassLibraryBuilder appendSource(java.io.File file) throws java.io.IOException
- Specified by:
appendSourcein interfaceClassLibraryBuilder- Parameters:
file- the Java source as file- Returns:
- this ClassLibraryBuilder instance
- Throws:
java.io.IOException- if an IOException occurs
-
setDebugLexer
public ClassLibraryBuilder setDebugLexer(boolean debugLexer)
Description copied from interface:ClassLibraryBuilderSet totrueto enable debug logging for the lexer- Specified by:
setDebugLexerin interfaceClassLibraryBuilder- Parameters:
debugLexer- the debug logging flag- Returns:
- this ClassLibraryBuilder instance
-
setDebugParser
public ClassLibraryBuilder setDebugParser(boolean debugParser)
Description copied from interface:ClassLibraryBuilderSet totrueto enable debug logging for the parser- Specified by:
setDebugParserin interfaceClassLibraryBuilder- Parameters:
debugParser- the debug logging flag- Returns:
- this ClassLibraryBuilder instance
-
setEncoding
public ClassLibraryBuilder setEncoding(java.lang.String encoding)
- Specified by:
setEncodingin interfaceClassLibraryBuilder- Parameters:
encoding- set the encoding- Returns:
- this ClassLibraryBuilder instance
-
setErrorHander
public ClassLibraryBuilder setErrorHander(ErrorHandler errorHandler)
Description copied from interface:ClassLibraryBuilderCan handle ParseExceptions instead of crashing. Has only effect on the appendSource() methods- Specified by:
setErrorHanderin interfaceClassLibraryBuilder- Parameters:
errorHandler- the errorHandler- Returns:
- this ClassLibraryBuilder instance
-
setModelBuilderFactory
public ClassLibraryBuilder setModelBuilderFactory(ModelBuilderFactory factory)
Description copied from interface:ClassLibraryBuilderDefine theModelBuilderFactorywhich the parsers should use to construct the JavaModel Objects- Specified by:
setModelBuilderFactoryin interfaceClassLibraryBuilder- Parameters:
factory- the modelBuilderFactory- Returns:
- this ClassLibraryBuilder instance
-
setModelWriterFactory
public ClassLibraryBuilder setModelWriterFactory(ModelWriterFactory modelWriterFactory)
Description copied from interface:ClassLibraryBuilderDefine theModelWriterFactorywhich is used by the classes when calling for the codeBlock.- Specified by:
setModelWriterFactoryin interfaceClassLibraryBuilder- Parameters:
modelWriterFactory- the modelWriterFactory- Returns:
- this ClassLibraryBuilder instance
-
getClassLibrary
public ClassLibrary getClassLibrary()
Description copied from interface:ClassLibraryBuilderGet the library based on the strategy of the implementation- Specified by:
getClassLibraryin interfaceClassLibraryBuilder- Returns:
- the constructed ClassLibrary
-
addSource
public JavaSource addSource(java.io.InputStream stream) throws java.io.IOException
- Specified by:
addSourcein interfaceClassLibraryBuilder- 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
public JavaSource addSource(java.io.Reader reader)
Description copied from interface:ClassLibraryBuilderAdd the source content of the reader to the ClassLibrary and return the generated JavaSource- Specified by:
addSourcein interfaceClassLibraryBuilder- Parameters:
reader- the Java source as reader- Returns:
- the created JavaSource
-
addSource
public JavaSource addSource(java.net.URL url) throws java.io.IOException
- Specified by:
addSourcein interfaceClassLibraryBuilder- Parameters:
url- the Java source as URL- Returns:
- the created JavaSource
- Throws:
java.io.IOException- if an IOException occurs
-
addSource
public JavaSource addSource(java.io.File file) throws java.io.IOException
- Specified by:
addSourcein interfaceClassLibraryBuilder- Parameters:
file- the Java source as file- Returns:
- the created JavaSource
- Throws:
java.io.IOException- if an IOException occurs
-
addSourceFolder
public JavaModule addSourceFolder(java.io.File sourceFolder)
- Specified by:
addSourceFolderin interfaceClassLibraryBuilder- Parameters:
sourceFolder- the sourcefolder- Returns:
- the module info if the sourcefolder has a module-info.java, otherwise
null
-
-