Class TypeResolver

java.lang.Object
com.thoughtworks.qdox.type.TypeResolver

public class TypeResolver extends Object
A per JavaClass resolver of types
Since:
2.0
  • Field Details

    • PRIMITIVE_TYPES

      private static final Set<String> PRIMITIVE_TYPES
    • resolvedTypeCache

      private final Map<String,String> resolvedTypeCache
    • pckg

      private final String pckg
    • declaringClass

      private final String declaringClass
    • classLibrary

      private final ClassLibrary classLibrary
    • imports

      private final Collection<String> imports
  • Constructor Details

  • Method Details

    • byPackageName

      public static TypeResolver byPackageName(String binaryName, ClassLibrary classLibrary, Collection<String> imports)
      Type resolver in case there's no declaring class, e.g. using extends, implements and annotations on a toplevel class
      Parameters:
      binaryName - the binary name of the package
      classLibrary - the class library
      imports - the imports, can be null
      Returns:
      the typeResolver
    • byClassName

      public static TypeResolver byClassName(String binaryName, ClassLibrary classLibrary, Collection<String> imports)
      Parameters:
      binaryName - the class in which context a type is used.
      classLibrary - the class library
      imports - the imports, can be null
      Returns:
      the typeResolver
    • resolveJavaClass

      public JavaClass resolveJavaClass(String typeName)
    • getJavaClass

      public JavaClass getJavaClass(String binaryName)
    • resolveType

      public String resolveType(String typeName)
    • resolveTypeInternal

      private String resolveTypeInternal(String typeName)
      Resolves a type name

      Follows the Java Language Specification, Version 3.0.

      Current resolution order is:

      1. Single-Type-Import Declaration
      2. Type-Import-on-Demand Declaration
      3. Automatic Imports
      Parameters:
      typeName - the name to resolve
      Returns:
      the resolved type name, otherwise null
    • resolveImportedType

      private String resolveImportedType(String importSpec, String typeName, boolean fullMatch)
    • resolveFromLibrary

      private String resolveFromLibrary(String typeName)
    • resolveFullyQualifiedType

      private String resolveFullyQualifiedType(String typeName)