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 Details

    • 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)
      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

      <T> Set<T> get(Class<T> type)
      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

      ResourceSet parseDirectory(org.eclipse.jdt.core.dom.ASTParser parser, Path dir)
      Parses the directory.
      Parameters:
      parser - the parser
      dir - the dir
      Returns:
      the resource set
    • parsePackage

      ResourceSet parsePackage(org.eclipse.jdt.core.IPackageFragment javaPackage)
      Parses the package.
      Parameters:
      javaPackage - the java package
      Returns:
      the resource set
    • parseProject

      ResourceSet parseProject(org.eclipse.jdt.core.IJavaProject javaProject)
      Parses the project.
      Parameters:
      javaProject - the java project
      Returns:
      the resource set
    • getSourcepathEntries

      String[] getSourcepathEntries(Path dir)
      Gets the sourcepath entries.
      Parameters:
      dir - the dir
      Returns:
      the sourcepath entries