Package jamopp.parser.api
Interface JaMoPPParserAPI
-
- All Known Implementing Classes:
JaMoPPJDTParser
,JaMoPPJDTSingleFileParser
public interface JaMoPPParserAPI
This interface provides an API for parsers that read Java source files and convert them to Java model instances.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default 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 directory)
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.default ResourceSet
parseUri(URI uri)
void
setResourceSet(ResourceSet set)
Sets the ResourceSet that is used to create Resources if new Resource instances are needed.
-
-
-
Method Detail
-
parse
JavaRoot parse(String fileName, InputStream input)
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
Resource parseFile(Path file)
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
ResourceSet parseDirectory(Path directory)
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
void setResourceSet(ResourceSet set)
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
default ResourceSet parseUri(URI uri)
-
-