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(File file)
Add a
File containing java code to this library |
JavaSource |
addSource(InputStream stream)
Add an
InputStream containing java code to this library |
JavaSource |
addSource(Reader reader)
Add a
Reader containing java code to this library |
JavaSource |
addSource(URL url)
Add a
URL containing java code to this library |
protected boolean |
containsClassReference(String name)
This method is used to detect if there's a match with this classname.
|
String |
getEncoding() |
ErrorHandler |
getErrorHandler() |
Collection<JavaClass> |
getJavaClasses()
Get all classes, including those from parent SourceLibraries
|
Collection<JavaPackage> |
getJavaPackages()
Get all packages, including those from parent SourceLibraries
|
Collection<JavaSource> |
getJavaSources()
Get all sources, including those from parent SourceLibraries
|
boolean |
isDebugLexer() |
boolean |
isDebugParser() |
protected JavaSource |
parse(InputStream stream,
URL url) |
protected JavaSource |
parse(Reader reader,
URL url) |
protected void |
registerJavaSource(JavaSource source) |
protected JavaClass |
resolveJavaClass(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(String name) |
void |
setDebugLexer(boolean debugLexer)
Use the Lexer in debug mode
|
void |
setDebugParser(boolean debugParser)
Use the Parser in debug mode
|
void |
setEncoding(String encoding)
Sets the encoding to use when parsing a URL or InputStreamReader
|
void |
setErrorHandler(ErrorHandler errorHandler) |
getJavaClass, getJavaClass, getJavaClasses, getJavaPackage, getJavaPackages, getJavaSources, getModelBuilder, getModelBuilder, getModelBuilderFactory, getModelWriterFactory, hasClassReference, setModelBuilderFactory, setModelWriterFactory
public SourceLibrary(AbstractClassLibrary parent)
parent
- public JavaSource addSource(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(InputStream stream) throws ParseException, 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 JavaModelIOException
public JavaSource addSource(URL url) throws ParseException, 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 JavaModelIOException
public JavaSource addSource(File file) throws ParseException, IOException
File
containing java code to this libraryfile
- a File
which should contain java codeJavaSource
object of this fileParseException
IOException
protected JavaSource parse(Reader reader, URL url) throws ParseException
ParseException
protected JavaSource parse(InputStream stream, URL url) throws ParseException, UnsupportedEncodingException
protected JavaClass resolveJavaClass(String name)
AbstractClassLibrary
resolveJavaClass
in class AbstractClassLibrary
name
- the fully qualified namenull
protected JavaPackage resolveJavaPackage(String name)
resolveJavaPackage
in class AbstractClassLibrary
protected final void registerJavaSource(JavaSource source)
source
- the source, might be null
public final void setDebugLexer(boolean debugLexer)
debugLexer
- public final boolean isDebugLexer()
public final void setDebugParser(boolean debugParser)
debugParser
- public final boolean isDebugParser()
public final void setEncoding(String encoding)
encoding
- public final String getEncoding()
public final void setErrorHandler(ErrorHandler errorHandler)
public final ErrorHandler getErrorHandler()
public Collection<JavaClass> getJavaClasses()
getJavaClasses
in interface ClassLibrary
getJavaClasses
in class AbstractClassLibrary
public Collection<JavaPackage> getJavaPackages()
getJavaPackages
in interface ClassLibrary
getJavaPackages
in class AbstractClassLibrary
public Collection<JavaSource> getJavaSources()
getJavaSources
in interface ClassLibrary
getJavaSources
in class AbstractClassLibrary
null
protected boolean containsClassReference(String name)
AbstractClassLibrary
containsClassReference
in class AbstractClassLibrary
name
- the fully qualified name of the classCopyright © 2002–2016. All rights reserved.