Class JarTypeSolver
- java.lang.Object
-
- com.github.javaparser.symbolsolver.resolution.typesolvers.JarTypeSolver
-
- All Implemented Interfaces:
com.github.javaparser.resolution.TypeSolver
public class JarTypeSolver extends java.lang.Object implements com.github.javaparser.resolution.TypeSolverWill let the symbol solver look inside a jar file while solving types.- Author:
- Federico Tomassetti
-
-
Constructor Summary
Constructors Constructor Description JarTypeSolver(java.io.File pathToJarOrClassFileHierarchy)Create aJarTypeSolverfrom aFile.JarTypeSolver(java.io.InputStream jarInputStream)Create aJarTypeSolverfrom aInputStream.JarTypeSolver(java.lang.String pathToJarOrClassFileHierarchy)Create aJarTypeSolverfrom a path in aStringformat.JarTypeSolver(java.nio.file.Path pathToJarOrClassFileHierarchy)Create aJarTypeSolverfrom aPath.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static JarTypeSolvergetJarTypeSolver(java.lang.String pathToJar)Deprecated.Use of this static method (previously following singleton pattern) is strongly discouraged and will be removed in a future version.java.util.Set<java.lang.String>getKnownClasses()Get the set of classes that can be resolved in the current type solver.com.github.javaparser.resolution.TypeSolvergetParent()voidsetParent(com.github.javaparser.resolution.TypeSolver parent)com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclarationsolveType(java.lang.String name)com.github.javaparser.resolution.model.SymbolReference<com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration>tryToSolveType(java.lang.String name)com.github.javaparser.resolution.model.SymbolReference<com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration>tryToSolveTypeInModule(java.lang.String qualifiedModuleName, java.lang.String simpleTypeName)https://docs.oracle.com/javase/specs/jvms/se25/html/jvms-4.html#jvms-4.7.25
-
-
-
Constructor Detail
-
JarTypeSolver
public JarTypeSolver(java.nio.file.Path pathToJarOrClassFileHierarchy) throws java.io.IOExceptionCreate aJarTypeSolverfrom aPath.- Parameters:
pathToJarOrClassFileHierarchy- The path where the jar or class file hierarchy is located.- Throws:
java.io.IOException- If an I/O exception occurs while reading the Jar or class file hierarchy.
-
JarTypeSolver
public JarTypeSolver(java.io.File pathToJarOrClassFileHierarchy) throws java.io.IOExceptionCreate aJarTypeSolverfrom aFile.- Parameters:
pathToJarOrClassFileHierarchy- The file pointing to the jar or class file hierarchy is located.- Throws:
java.io.IOException- If an I/O exception occurs while reading the Jar or class file hierarchy.
-
JarTypeSolver
public JarTypeSolver(java.lang.String pathToJarOrClassFileHierarchy) throws java.io.IOExceptionCreate aJarTypeSolverfrom a path in aStringformat.- Parameters:
pathToJarOrClassFileHierarchy- The path pointing to the jar or class file hierarchy.- Throws:
java.io.IOException- If an I/O exception occurs while reading the Jar or class file hierarchy.
-
JarTypeSolver
public JarTypeSolver(java.io.InputStream jarInputStream) throws java.io.IOExceptionCreate aJarTypeSolverfrom aInputStream. The content will be dumped into a temporary file to be used in the type solver.- Parameters:
jarInputStream- The input stream to be used.- Throws:
java.io.IOException- If an I/O exception occurs while creating the temporary file.
-
-
Method Detail
-
getJarTypeSolver
@Deprecated public static JarTypeSolver getJarTypeSolver(java.lang.String pathToJar) throws java.io.IOException
Deprecated.Use of this static method (previously following singleton pattern) is strongly discouraged and will be removed in a future version. For now, it has been modified to return a new instance to prevent the IllegalStateException being thrown (as reported in #2547), allowing it to be called multiple times.- Throws:
java.io.IOException
-
getKnownClasses
public java.util.Set<java.lang.String> getKnownClasses()
Get the set of classes that can be resolved in the current type solver.- Returns:
- The set of known classes.
-
getParent
public com.github.javaparser.resolution.TypeSolver getParent()
- Specified by:
getParentin interfacecom.github.javaparser.resolution.TypeSolver
-
setParent
public void setParent(com.github.javaparser.resolution.TypeSolver parent)
- Specified by:
setParentin interfacecom.github.javaparser.resolution.TypeSolver
-
tryToSolveType
public com.github.javaparser.resolution.model.SymbolReference<com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration> tryToSolveType(java.lang.String name)
- Specified by:
tryToSolveTypein interfacecom.github.javaparser.resolution.TypeSolver
-
solveType
public com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration solveType(java.lang.String name) throws com.github.javaparser.resolution.UnsolvedSymbolException- Specified by:
solveTypein interfacecom.github.javaparser.resolution.TypeSolver- Throws:
com.github.javaparser.resolution.UnsolvedSymbolException
-
tryToSolveTypeInModule
public com.github.javaparser.resolution.model.SymbolReference<com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration> tryToSolveTypeInModule(java.lang.String qualifiedModuleName, java.lang.String simpleTypeName)https://docs.oracle.com/javase/specs/jvms/se25/html/jvms-4.html#jvms-4.7.25- Specified by:
tryToSolveTypeInModulein interfacecom.github.javaparser.resolution.TypeSolver- Parameters:
qualifiedModuleName-simpleTypeName-- Returns:
-
-