public class SourceLibrary extends AbstractClassLibrary
| Constructor and Description |
|---|
SourceLibrary(AbstractClassLibrary parent)
Create a new instance of SourceLibrary and chain it to the parent
|
| Modifier and Type | Method and Description |
|---|---|
JavaSource |
addSource(java.io.File file)
Add a
File containing java code to this library |
JavaSource |
addSource(java.io.InputStream stream)
Add an
InputStream containing java code to this library |
JavaSource |
addSource(java.io.Reader reader)
Add a
Reader containing java code to this library |
JavaSource |
addSource(java.net.URL url)
Add a
URL containing java code to this library |
protected boolean |
containsClassReference(java.lang.String name)
This method is used to detect if there's a match with this classname.
|
java.lang.String |
getEncoding() |
ErrorHandler |
getErrorHandler() |
java.util.Collection<JavaClass> |
getJavaClasses()
Get all classes, including those from parent SourceLibraries
|
java.util.Collection<JavaPackage> |
getJavaPackages()
Get all packages, including those from parent SourceLibraries
|
java.util.Collection<JavaSource> |
getJavaSources()
Get all sources, including those from parent SourceLibraries
|
boolean |
isDebugLexer() |
boolean |
isDebugParser() |
protected void |
registerJavaSource(JavaSource source) |
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)
Use the Lexer in debug mode
|
void |
setDebugParser(boolean debugParser)
Use the Parser in debug mode
|
void |
setEncoding(java.lang.String encoding)
Sets the encoding to use when parsing a URL or InputStreamReader
|
void |
setErrorHandler(ErrorHandler errorHandler) |
getJavaClass, getJavaClass, getJavaClasses, getJavaModules, getJavaPackage, getJavaPackages, getJavaSources, getModelBuilder, getModelBuilder, getModelBuilderFactory, getModelWriterFactory, hasClassReference, setModelBuilderFactory, setModelWriterFactorypublic SourceLibrary(AbstractClassLibrary parent)
parent - the parent classLibrarypublic JavaSource addSource(java.io.Reader reader) throws ParseException
Reader containing java code to this libraryreader - a Reader which should contain java codeJavaSource object of this readerParseException - if this content couldn't be parsed to a JavaModelpublic JavaSource addSource(java.io.InputStream stream) throws ParseException, java.io.IOException
InputStream containing java code to this librarystream - an InputStream which should contain java codeJavaSource object of this streamParseException - if this content couldn't be parsed to a JavaModeljava.io.IOException - if an IOException occurspublic JavaSource addSource(java.net.URL url) throws ParseException, java.io.IOException
URL containing java code to this libraryurl - a URL which should contain java codeJavaSource object of this urlParseException - if this content couldn't be parsed to a JavaModeljava.io.IOException - if an IOException occurspublic JavaSource addSource(java.io.File file) throws ParseException, java.io.IOException
File containing java code to this libraryfile - a File which should contain java codeJavaSource object of this fileParseException - if this content couldn't be parsed to a JavaModeljava.io.IOException - if an IOException occursprotected JavaClass resolveJavaClass(java.lang.String name)
AbstractClassLibraryresolveJavaClass in class AbstractClassLibraryname - the fully qualified namenullprotected JavaPackage resolveJavaPackage(java.lang.String name)
resolveJavaPackage in class AbstractClassLibraryprotected final void registerJavaSource(JavaSource source)
source - the source, might be nullpublic final void setDebugLexer(boolean debugLexer)
debugLexer - the debug logging flagpublic final boolean isDebugLexer()
public final void setDebugParser(boolean debugParser)
debugParser - the debug logging flagpublic final boolean isDebugParser()
public final void setEncoding(java.lang.String encoding)
encoding - the source encodingpublic final java.lang.String getEncoding()
public final void setErrorHandler(ErrorHandler errorHandler)
public final ErrorHandler getErrorHandler()
public java.util.Collection<JavaClass> getJavaClasses()
getJavaClasses in interface ClassLibrarygetJavaClasses in class AbstractClassLibrarypublic java.util.Collection<JavaPackage> getJavaPackages()
getJavaPackages in interface ClassLibrarygetJavaPackages in class AbstractClassLibrarypublic java.util.Collection<JavaSource> getJavaSources()
getJavaSources in interface ClassLibrarygetJavaSources in class AbstractClassLibrarynullprotected boolean containsClassReference(java.lang.String name)
AbstractClassLibrarycontainsClassReference in class AbstractClassLibraryname - the fully qualified name of the classCopyright © 2002-2018. All Rights Reserved.