Package jamopp.parser.jdt
Class JaMoPPJDTParser
- java.lang.Object
-
- jamopp.parser.jdt.JaMoPPJDTParser
-
- All Implemented Interfaces:
JaMoPPParserAPI
public class JaMoPPJDTParser extends Object implements JaMoPPParserAPI
-
-
Constructor Summary
Constructors Constructor Description JaMoPPJDTParser()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JavaRoot
parse(String fileName, InputStream input)
Reads an InputStream and parses its content into a Java model instance.ResourceSet
parseDirectory(Path dir)
Visits all files and directories in a directory and parses all found Java source files.Resource
parseFile(Path file)
Reads a file and parses its content into a Java model instance.void
setResourceSet(ResourceSet set)
Sets the ResourceSet that is used to create Resources if new Resource instances are needed.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jamopp.parser.api.JaMoPPParserAPI
parseUri
-
-
-
-
Method Detail
-
parse
public JavaRoot parse(String fileName, InputStream input)
Description copied from interface:JaMoPPParserAPI
Reads an InputStream and parses its content into a Java model instance.- Specified by:
parse
in interfaceJaMoPPParserAPI
- Parameters:
fileName
- name of the Java source file which will be read.input
- the InputStream to read.- Returns:
- the created Java model instance or null if the InputStream could not be read.
-
parseFile
public Resource parseFile(Path file)
Description copied from interface:JaMoPPParserAPI
Reads a file and parses its content into a Java model instance.- Specified by:
parseFile
in interfaceJaMoPPParserAPI
- Parameters:
file
- the Java source file.- Returns:
- the created Java model instance contained in its associated Resource instance or null if the file could not be read.
-
parseDirectory
public ResourceSet parseDirectory(Path dir)
Description copied from interface:JaMoPPParserAPI
Visits all files and directories in a directory and parses all found Java source files. It is assumed that the given directory is a Java source folder containing sub-directories representing a Java package hierarchy.- Specified by:
parseDirectory
in interfaceJaMoPPParserAPI
- Parameters:
dir
- the directory to search for Java source files.- Returns:
- a ResourceSet containing all parsed source files with their associated Resources.
-
setResourceSet
public void setResourceSet(ResourceSet set)
Description copied from interface:JaMoPPParserAPI
Sets the ResourceSet that is used to create Resources if new Resource instances are needed. If no ResourceSet is provided, a ResourceSet is created.- Specified by:
setResourceSet
in interfaceJaMoPPParserAPI
- Parameters:
set
- the ResourceSet.
-
-