Class TypeSet
- java.lang.Object
-
- net.sourceforge.pmd.lang.java.symboltable.TypeSet
-
public class TypeSet extends java.lang.ObjectKeeps track of the types encountered in a ASTCompilationUnit
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTypeSet.AbstractResolverBase Resolver class that support aPMDASMClassLoaderclass loader.static classTypeSet.CurrentPackageResolverResolver that uses the current package to resolve a simple class name.static classTypeSet.ExplicitImportResolverResolver that tries to resolve the given simple class name with the explicit import statements.static classTypeSet.FullyQualifiedNameResolverResolver that simply loads the class by name.static classTypeSet.ImplicitImportResolverResolver that resolves simple class names from the implicit import ofjava.lang.*.static classTypeSet.ImportOnDemandResolverResolver that uses the "on demand" import statements.static classTypeSet.PrimitiveTypeResolverResolver that resolves primitive types such as int or double.static interfaceTypeSet.ResolverA resolver that can resolve a class by name.static classTypeSet.VoidResolverResolver that resolves the "void" type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddImport(java.lang.String importString)Adds a import to the list of importsjava.lang.Class<?>findClass(java.lang.String name)Resolves a class by its name using all known resolvers.java.lang.StringgetASTCompilationUnitPackage()java.util.Set<java.lang.String>getExplicitImports()intgetImportsCount()booleanhasAuxclasspath()Whether the classloader is using the auxclasspath or not.voidsetASTCompilationUnitPackage(java.lang.String pkg)
-
-
-
Constructor Detail
-
TypeSet
public TypeSet()
TheTypeSetprovides type resolution for the symbol facade.
-
TypeSet
public TypeSet(java.lang.ClassLoader classLoader)
TheTypeSetprovides type resolution for the symbol facade.- Parameters:
classLoader- the class loader to use to search classes (could be an auxiliary class path)
-
-
Method Detail
-
hasAuxclasspath
public boolean hasAuxclasspath()
Whether the classloader is using the auxclasspath or not.- Returns:
trueif the classloader is using the auxclasspath feature
-
setASTCompilationUnitPackage
public void setASTCompilationUnitPackage(java.lang.String pkg)
-
getASTCompilationUnitPackage
public java.lang.String getASTCompilationUnitPackage()
-
addImport
public void addImport(java.lang.String importString)
Adds a import to the list of imports- Parameters:
importString- the import to add
-
getImportsCount
public int getImportsCount()
-
getExplicitImports
public java.util.Set<java.lang.String> getExplicitImports()
-
findClass
public java.lang.Class<?> findClass(java.lang.String name)
Resolves a class by its name using all known resolvers.- Parameters:
name- the name of the class, can be a simple name or a fully qualified name.- Returns:
- the class or
nullif none found
-
-