Package tools.mdsd.jamopp.parser
Interface JaMoPPParserAPI
- All Known Implementing Classes:
JaMoPPJDTParser
public interface JaMoPPParserAPI
This interface provides an API for parsers that read Java source files and
convert them to Java model instances.
-
Method Summary
Modifier and TypeMethodDescriptionconvertCompilationUnits(Map<String, org.eclipse.jdt.core.dom.CompilationUnit> compilationUnits) Convert compilation units.<T> Set<T>Gets the.Gets the resource set.String[]getSourcepathEntries(Path dir) Gets the sourcepath entries.parse(String fileName, InputStream input) Reads an InputStream and parses its content into a Java model instance.parseDirectory(Path directory) Visits all files and directories in a directory and parses all found Java source files.parseDirectory(org.eclipse.jdt.core.dom.ASTParser parser, Path dir) Parses the directory.Reads a file and parses its content into a Java model instance.parsePackage(org.eclipse.jdt.core.IPackageFragment javaPackage) Parses the package.parseProject(org.eclipse.jdt.core.IJavaProject javaProject) Parses the project.default ResourceSetParses the uri.voidSets the ResourceSet that is used to create Resources if new Resource instances are needed.
-
Method Details
-
parse
Reads an InputStream and parses its content into a Java model instance.- 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
Reads a file and parses its content into a Java model instance.- 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
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.- Parameters:
directory- the directory to search for Java source files.- Returns:
- a ResourceSet containing all parsed source files with their associated Resources.
-
setResourceSet
Sets the ResourceSet that is used to create Resources if new Resource instances are needed. If no ResourceSet is provided, a ResourceSet is created.- Parameters:
set- the ResourceSet.
-
parseUri
Parses the uri.- Parameters:
uri- the uri- Returns:
- the resource set
-
convertCompilationUnits
List<JavaRoot> convertCompilationUnits(Map<String, org.eclipse.jdt.core.dom.CompilationUnit> compilationUnits) Convert compilation units.- Parameters:
compilationUnits- the compilation units- Returns:
- the list
-
get
Gets the.- Type Parameters:
T- the generic type- Parameters:
type- the type- Returns:
- the sets the
-
getResourceSet
ResourceSet getResourceSet()Gets the resource set.- Returns:
- the resource set
-
parseDirectory
Parses the directory.- Parameters:
parser- the parserdir- the dir- Returns:
- the resource set
-
parsePackage
Parses the package.- Parameters:
javaPackage- the java package- Returns:
- the resource set
-
parseProject
Parses the project.- Parameters:
javaProject- the java project- Returns:
- the resource set
-
getSourcepathEntries
Gets the sourcepath entries.- Parameters:
dir- the dir- Returns:
- the sourcepath entries
-