Package tools.mdsd.jamopp.parser
Class JaMoPPJDTParser
java.lang.Object
tools.mdsd.jamopp.parser.JaMoPPJDTParser
- All Implemented Interfaces:
JaMoPPParserAPI
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionconvertCompilationUnits
(Map<String, org.eclipse.jdt.core.dom.CompilationUnit> compilationUnits) Convert compilation units.boolean
<T> Set<T>
Gets the.static String[]
getClasspathEntries
(Path dir) getCompilationUnits
(org.eclipse.jdt.core.dom.ASTParser parser, String[] classpathEntries, String[] sources, String[] encodings) static org.eclipse.jdt.core.dom.ASTParser
getJavaParser
(String version) Gets the resource set.String[]
getSourcepathEntries
(Path dir) Gets the sourcepath entries.int
hashCode()
parse
(String fileName, InputStream input) Reads an InputStream and parses its content into a Java model instance.parseDirectory
(Path dir) 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.void
Sets the ResourceSet that is used to create Resources if new Resource instances are needed.toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface tools.mdsd.jamopp.parser.JaMoPPParserAPI
parseUri
-
Field Details
-
DEFAULT_ENCODING
-
DEFAULT_JAVA_VERSION
-
-
Constructor Details
-
JaMoPPJDTParser
public JaMoPPJDTParser()
-
-
Method Details
-
convertCompilationUnits
public List<JavaRoot> convertCompilationUnits(Map<String, org.eclipse.jdt.core.dom.CompilationUnit> compilationUnits) Description copied from interface:JaMoPPParserAPI
Convert compilation units.- Specified by:
convertCompilationUnits
in interfaceJaMoPPParserAPI
- Parameters:
compilationUnits
- the compilation units- Returns:
- the list
-
equals
-
get
Description copied from interface:JaMoPPParserAPI
Gets the.- Specified by:
get
in interfaceJaMoPPParserAPI
- Type Parameters:
T
- the generic type- Parameters:
type
- the type- Returns:
- the sets the
-
getResourceSet
Description copied from interface:JaMoPPParserAPI
Gets the resource set.- Specified by:
getResourceSet
in interfaceJaMoPPParserAPI
- Returns:
- the resource set
-
getSourcepathEntries
Description copied from interface:JaMoPPParserAPI
Gets the sourcepath entries.- Specified by:
getSourcepathEntries
in interfaceJaMoPPParserAPI
- Parameters:
dir
- the dir- Returns:
- the sourcepath entries
-
hashCode
public int hashCode() -
parse
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.
-
parseDirectory
Description copied from interface:JaMoPPParserAPI
Parses the directory.- Specified by:
parseDirectory
in interfaceJaMoPPParserAPI
- Parameters:
parser
- the parserdir
- the dir- Returns:
- the resource set
-
parseDirectory
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.
-
parseFile
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.
-
parsePackage
Description copied from interface:JaMoPPParserAPI
Parses the package.- Specified by:
parsePackage
in interfaceJaMoPPParserAPI
- Parameters:
javaPackage
- the java package- Returns:
- the resource set
-
parseProject
Description copied from interface:JaMoPPParserAPI
Parses the project.- Specified by:
parseProject
in interfaceJaMoPPParserAPI
- Parameters:
javaProject
- the java project- Returns:
- the resource set
-
setResourceSet
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.
-
toString
-
getClasspathEntries
-
getCompilationUnits
-
getJavaParser
-