Class JarTypeSolver
java.lang.Object
com.github.javaparser.symbolsolver.resolution.typesolvers.JarTypeSolver
- All Implemented Interfaces:
com.github.javaparser.resolution.TypeSolver
Will let the symbol solver look inside a jar file while solving types.
- Author:
- Federico Tomassetti
-
Field Summary
Fields inherited from interface com.github.javaparser.resolution.TypeSolver
JAVA_LANG_OBJECT, JAVA_LANG_RECORD -
Constructor Summary
ConstructorsConstructorDescriptionJarTypeSolver(File pathToJarOrClassFileHierarchy) Create aJarTypeSolverfrom aFile.JarTypeSolver(InputStream jarInputStream) Create aJarTypeSolverfrom aInputStream.JarTypeSolver(String pathToJarOrClassFileHierarchy) Create aJarTypeSolverfrom a path in aStringformat.JarTypeSolver(Path pathToJarOrClassFileHierarchy) Create aJarTypeSolverfrom aPath. -
Method Summary
Modifier and TypeMethodDescriptionstatic JarTypeSolvergetJarTypeSolver(String pathToJar) Deprecated.Use of this static method (previously following singleton pattern) is strongly discouraged and will be removed in a future version.Get the set of classes that can be resolved in the current type solver.com.github.javaparser.resolution.TypeSolvervoidsetParent(com.github.javaparser.resolution.TypeSolver parent) com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclarationcom.github.javaparser.resolution.model.SymbolReference<com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration> tryToSolveType(String name) com.github.javaparser.resolution.model.SymbolReference<com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration> tryToSolveTypeInModule(String qualifiedModuleName, String simpleTypeName) https://docs.oracle.com/javase/specs/jvms/se25/html/jvms-4.html#jvms-4.7.25Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.github.javaparser.resolution.TypeSolver
getRoot, getSolvedJavaLangObject, getSolvedJavaLangRecord, hasType, solveTypeInModule
-
Constructor Details
-
JarTypeSolver
Create aJarTypeSolverfrom aPath.- Parameters:
pathToJarOrClassFileHierarchy- The path where the jar or class file hierarchy is located.- Throws:
IOException- If an I/O exception occurs while reading the Jar or class file hierarchy.
-
JarTypeSolver
Create aJarTypeSolverfrom aFile.- Parameters:
pathToJarOrClassFileHierarchy- The file pointing to the jar or class file hierarchy is located.- Throws:
IOException- If an I/O exception occurs while reading the Jar or class file hierarchy.
-
JarTypeSolver
Create aJarTypeSolverfrom a path in aStringformat.- Parameters:
pathToJarOrClassFileHierarchy- The path pointing to the jar or class file hierarchy.- Throws:
IOException- If an I/O exception occurs while reading the Jar or class file hierarchy.
-
JarTypeSolver
Create 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:
IOException- If an I/O exception occurs while creating the temporary file.
-
-
Method Details
-
getJarTypeSolver
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:
IOException
-
getKnownClasses
-
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(String name) - Specified by:
tryToSolveTypein interfacecom.github.javaparser.resolution.TypeSolver
-
solveType
public com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration solveType(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(String qualifiedModuleName, 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:
-