Package jamopp.parser.jdt
Class JaMoPPJDTParser
- java.lang.Object
-
- jamopp.parser.jdt.JaMoPPJDTParser
-
- All Implemented Interfaces:
JaMoPPParserAPI
public final class JaMoPPJDTParser extends Object implements JaMoPPParserAPI
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_ENCODINGstatic StringDEFAULT_JAVA_VERSION
-
Constructor Summary
Constructors Constructor Description JaMoPPJDTParser()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description List<JavaRoot>convertCompilationUnits(Map<String,org.eclipse.jdt.core.dom.CompilationUnit> compilationUnits)booleanequals(Object obj)<T> Set<T>get(Class<T> type)static String[]getClasspathEntries(Path dir)static Map<String,org.eclipse.jdt.core.dom.CompilationUnit>getCompilationUnits(org.eclipse.jdt.core.dom.ASTParser parser, String[] classpathEntries, String[] sources, String[] encodings)static org.eclipse.jdt.core.dom.ASTParsergetJavaParser(String version)ResourceSetgetResourceSet()String[]getSourcepathEntries(Path dir)inthashCode()JavaRootparse(String fileName, InputStream input)Reads an InputStream and parses its content into a Java model instance.ResourceSetparseDirectory(Path dir)Visits all files and directories in a directory and parses all found Java source files.ResourceSetparseDirectory(org.eclipse.jdt.core.dom.ASTParser parser, Path dir)ResourceparseFile(Path file)Reads a file and parses its content into a Java model instance.ResourceSetparsePackage(org.eclipse.jdt.core.IPackageFragment javaPackage)ResourceSetparseProject(org.eclipse.jdt.core.IJavaProject javaProject)voidsetResourceSet(ResourceSet set)Sets the ResourceSet that is used to create Resources if new Resource instances are needed.StringtoString()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jamopp.parser.api.JaMoPPParserAPI
parseUri
-
-
-
-
Field Detail
-
DEFAULT_ENCODING
public static final String DEFAULT_ENCODING
-
DEFAULT_JAVA_VERSION
public static final String DEFAULT_JAVA_VERSION
- See Also:
- Constant Field Values
-
-
Method Detail
-
getCompilationUnits
public static Map<String,org.eclipse.jdt.core.dom.CompilationUnit> getCompilationUnits(org.eclipse.jdt.core.dom.ASTParser parser, String[] classpathEntries, String[] sources, String[] encodings)
-
getJavaParser
public static org.eclipse.jdt.core.dom.ASTParser getJavaParser(String version)
-
convertCompilationUnits
public List<JavaRoot> convertCompilationUnits(Map<String,org.eclipse.jdt.core.dom.CompilationUnit> compilationUnits)
-
getResourceSet
public ResourceSet getResourceSet()
- Returns:
- the resourceSet
-
parse
public JavaRoot parse(String fileName, InputStream input)
Description copied from interface:JaMoPPParserAPIReads an InputStream and parses its content into a Java model instance.- Specified by:
parsein 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
public ResourceSet parseDirectory(org.eclipse.jdt.core.dom.ASTParser parser, Path dir)
-
parseDirectory
public ResourceSet parseDirectory(Path dir)
Description copied from interface:JaMoPPParserAPIVisits 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:
parseDirectoryin interfaceJaMoPPParserAPI- Parameters:
dir- the directory to search for Java source files.- Returns:
- a ResourceSet containing all parsed source files with their associated Resources.
-
parseFile
public Resource parseFile(Path file)
Description copied from interface:JaMoPPParserAPIReads a file and parses its content into a Java model instance.- Specified by:
parseFilein 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
public ResourceSet parsePackage(org.eclipse.jdt.core.IPackageFragment javaPackage)
-
parseProject
public ResourceSet parseProject(org.eclipse.jdt.core.IJavaProject javaProject)
-
setResourceSet
public void setResourceSet(ResourceSet set)
Description copied from interface:JaMoPPParserAPISets 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:
setResourceSetin interfaceJaMoPPParserAPI- Parameters:
set- the ResourceSet.
-
-