- 所有超级接口:
Serializable
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.- 从以下版本开始:
- 2.0
- 作者:
- Robert Scholte
-
方法概要
修饰符和类型方法说明addSource(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 totrueto enable debug logging for the lexersetDebugParser(boolean debugParser) Set totrueto enable debug logging for the parsersetEncoding(String encoding) setErrorHander(ErrorHandler errorHandler) Can handle ParseExceptions instead of crashing.Define theModelBuilderFactorywhich the parsers should use to construct the JavaModel ObjectssetModelWriterFactory(ModelWriterFactory factory) Define theModelWriterFactorywhich is used by the classes when calling for the codeBlock.
-
方法详细资料
-
appendClassLoader
Append a classloader and return itself- 参数:
classLoader- the classloader to add- 返回:
- this ClassLibraryBuilder instance
-
appendDefaultClassLoaders
ClassLibraryBuilder appendDefaultClassLoaders()Add the defaultClassLoaders and return itse- 返回:
- this ClassLibraryBuilder instance
-
appendSourceFolder
- 参数:
sourceFolder- the source folder- 返回:
- this ClassLibraryBuilder instance
-
appendSource
- 参数:
stream- the Java source as stream- 返回:
- this ClassLibraryBuilder instance
- 抛出:
IOException- if an IOException is thrown, e.g. unsupported encoding
-
appendSource
- 参数:
reader- the Java source as reader- 返回:
- this ClassLibraryBuilder instance
-
appendSource
- 参数:
url- the Java source as URL- 返回:
- this ClassLibraryBuilder instance
- 抛出:
IOException- if an IOException occurs
-
appendSource
- 参数:
file- the Java source as file- 返回:
- this ClassLibraryBuilder instance
- 抛出:
IOException- if an IOException occurs
-
addSource
- 参数:
stream- the Java source as stream- 返回:
- the created JavaSource
- 抛出:
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- 参数:
reader- the Java source as reader- 返回:
- the created JavaSource
-
addSource
- 参数:
url- the Java source as URL- 返回:
- the created JavaSource
- 抛出:
IOException- if an IOException occurs
-
addSource
- 参数:
file- the Java source as file- 返回:
- the created JavaSource
- 抛出:
IOException- if an IOException occurs
-
setDebugLexer
Set totrueto enable debug logging for the lexer- 参数:
debugLexer- the debug logging flag- 返回:
- this ClassLibraryBuilder instance
-
setDebugParser
Set totrueto enable debug logging for the parser- 参数:
debugParser- the debug logging flag- 返回:
- this ClassLibraryBuilder instance
-
setEncoding
- 参数:
encoding- set the encoding- 返回:
- this ClassLibraryBuilder instance
-
setModelBuilderFactory
Define theModelBuilderFactorywhich the parsers should use to construct the JavaModel Objects- 参数:
factory- the modelBuilderFactory- 返回:
- this ClassLibraryBuilder instance
-
setModelWriterFactory
Define theModelWriterFactorywhich is used by the classes when calling for the codeBlock.- 参数:
factory- the modelWriterFactory- 返回:
- this ClassLibraryBuilder instance
-
getClassLibrary
ClassLibrary getClassLibrary()Get the library based on the strategy of the implementation- 返回:
- the constructed ClassLibrary
-
setErrorHander
Can handle ParseExceptions instead of crashing. Has only effect on the appendSource() methods- 参数:
errorHandler- the errorHandler- 返回:
- this ClassLibraryBuilder instance
-
addSourceFolder
- 参数:
sourceFolder- the sourcefolder- 返回:
- the module info if the sourcefolder has a module-info.java, otherwise
null - 从以下版本开始:
- 2.0
-