Class JavaSymbolSolver
java.lang.Object
com.github.javaparser.symbolsolver.JavaSymbolSolver
- All Implemented Interfaces:
com.github.javaparser.resolution.SymbolResolver
public class JavaSymbolSolver
extends Object
implements com.github.javaparser.resolution.SymbolResolver
This implementation of the SymbolResolver wraps the functionality of the library to make them easily usable
from JavaParser nodes.
An instance of this class should be created once and then injected in all the CompilationUnit for which we
want to enable symbol resolution. To do so the method inject can be used, or you can use
ParserConfiguration.setSymbolResolver(SymbolResolver) and the parser will do the
injection for you.
- Author:
- Federico Tomassetti
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.github.javaparser.resolution.types.ResolvedTypecalculateType(com.github.javaparser.ast.expr.Expression expression) voidinject(com.github.javaparser.ast.CompilationUnit destination) Register this SymbolResolver into a CompilationUnit, so that symbol resolution becomes available to all nodes part of the CompilationUnit.<T> TresolveDeclaration(com.github.javaparser.ast.Node node, Class<T> resultClass) <T> TtoResolvedType(com.github.javaparser.ast.type.Type javaparserType, Class<T> resultClass) com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclarationtoTypeDeclaration(com.github.javaparser.ast.Node node)
-
Constructor Details
-
JavaSymbolSolver
public JavaSymbolSolver(@NotNull com.github.javaparser.resolution.TypeSolver typeSolver)
-
-
Method Details
-
inject
public void inject(com.github.javaparser.ast.CompilationUnit destination) Register this SymbolResolver into a CompilationUnit, so that symbol resolution becomes available to all nodes part of the CompilationUnit. -
resolveDeclaration
- Specified by:
resolveDeclarationin interfacecom.github.javaparser.resolution.SymbolResolver
-
toResolvedType
public <T> T toResolvedType(com.github.javaparser.ast.type.Type javaparserType, Class<T> resultClass) - Specified by:
toResolvedTypein interfacecom.github.javaparser.resolution.SymbolResolver
-
calculateType
public com.github.javaparser.resolution.types.ResolvedType calculateType(com.github.javaparser.ast.expr.Expression expression) - Specified by:
calculateTypein interfacecom.github.javaparser.resolution.SymbolResolver
-
toTypeDeclaration
public com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration toTypeDeclaration(com.github.javaparser.ast.Node node) - Specified by:
toTypeDeclarationin interfacecom.github.javaparser.resolution.SymbolResolver
-