Class ResolvedType

java.lang.Object
com.fasterxml.classmate.ResolvedType
All Implemented Interfaces:
Type
Direct Known Subclasses:
ResolvedArrayType, ResolvedInterfaceType, ResolvedObjectType, ResolvedPrimitiveType, ResolvedRecursiveType, TypePlaceHolder

public abstract class ResolvedType extends Object implements Type
  • Field Details

    • NO_TYPES

      public static final ResolvedType[] NO_TYPES
    • NO_CONSTRUCTORS

      protected static final RawConstructor[] NO_CONSTRUCTORS
    • NO_FIELDS

      protected static final RawField[] NO_FIELDS
    • NO_METHODS

      protected static final RawMethod[] NO_METHODS
    • _erasedType

      protected final Class<?> _erasedType
    • _typeBindings

      protected final TypeBindings _typeBindings
      Type bindings active when resolving members (methods, fields, constructors) of this type
  • Constructor Details

  • Method Details

    • canCreateSubtypes

      public abstract boolean canCreateSubtypes()
      Method that can be used to check if call to TypeResolver.resolveSubtype(ResolvedType, Class) may ever succeed; if false, it will fail with an exception, if true, it may succeed.
    • canCreateSubtype

      public final boolean canCreateSubtype(Class<?> subtype)
      Method that can be used to check if call to TypeResolver.resolveSubtype(ResolvedType, Class) will succeed for specific type; if false, it will fail with an exception; if tru it will succeed.
    • getErasedType

      public Class<?> getErasedType()
      Returns type-erased Class<?> that this resolved type has.
    • getParentClass

      public abstract ResolvedType getParentClass()
      Returns parent class of this type, if it has one; primitive types and interfaces have no parent class, nor does Object type Object. Also, placeholders for cyclic (recursive) types return null for this method.
    • getSelfReferencedType

      public abstract ResolvedType getSelfReferencedType()
      Accessor that must be used to find out actual type in case of "self-reference"; case where type refers recursive to itself (like, T implements Comparable<T>). For all other types returns null but for self-references "real" type. Separate accessor is provided to avoid accidental infinite loops.
    • getArrayElementType

      public abstract ResolvedType getArrayElementType()
      Method that can be used to access element type of array types; will return null for non-array types, and non-null type for array types.
    • getImplementedInterfaces

      public abstract List<ResolvedType> getImplementedInterfaces()
      Returns ordered list of interfaces (in declaration order) that this type implements.
      Returns:
      List of interfaces this type implements, if any; empty list if none
    • getTypeParameters

      public List<ResolvedType> getTypeParameters()
      Returns list of generic type declarations for this type, in order they are declared in class description.
    • getTypeBindings

      public TypeBindings getTypeBindings()
      Method for accessing bindings of type variables to resolved types in context of this type. It has same number of entries as return List of getTypeParameters(), accessible using declared name to which they bind; for example, Map has 2 type bindings; one for key type (name "K", from Map.java) and one for value type (name "V", from Map.java).
    • typeParametersFor

      public List<ResolvedType> typeParametersFor(Class<?> erasedSupertype)
      Method that will try to find type parameterization this type has for specified super type
      Returns:
      List of type parameters for specified supertype (which may be empty, if supertype is not a parametric type); null if specified type is not a super type of this type
    • findSupertype

      public ResolvedType findSupertype(Class<?> erasedSupertype)
      Method for finding super type of this type that has specified type erased signature. If supertype is an interface which is implemented using multiple inheritance paths, preference is given to interfaces implemented "highest up the stack" (directly implemented interfaces over interfaces superclass implements).
    • isInterface

      public abstract boolean isInterface()
    • isConcrete

      public final boolean isConcrete()
    • isAbstract

      public abstract boolean isAbstract()
    • isArray

      public abstract boolean isArray()
      Method that indicates whether this type is an array type.
    • isPrimitive

      public abstract boolean isPrimitive()
      Method that indicates whether this type is one of small number of primitive Java types; not including array types of primitive types but just basic primitive types.
    • isInstanceOf

      public final boolean isInstanceOf(Class<?> type)
    • getConstructors

      public List<RawConstructor> getConstructors()
    • getMemberFields

      public List<RawField> getMemberFields()
    • getMemberMethods

      public List<RawMethod> getMemberMethods()
    • getStaticFields

      public List<RawField> getStaticFields()
    • getStaticMethods

      public List<RawMethod> getStaticMethods()
    • getSignature

      public String getSignature()
      Method that returns full generic signature of the type; suitable as signature for things like ASM package.
    • getErasedSignature

      public String getErasedSignature()
      Method that returns type erased signature of the type; suitable as non-generic signature some packages need
    • getFullDescription

      public String getFullDescription()
      Human-readable full description of type, which includes specification of super types (in brief format)
    • getBriefDescription

      public String getBriefDescription()
      Human-readable brief description of type, which does not include information about super types.
    • appendBriefDescription

      public abstract StringBuilder appendBriefDescription(StringBuilder sb)
    • appendFullDescription

      public abstract StringBuilder appendFullDescription(StringBuilder sb)
    • appendSignature

      public abstract StringBuilder appendSignature(StringBuilder sb)
    • appendErasedSignature

      public abstract StringBuilder appendErasedSignature(StringBuilder sb)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • _appendClassSignature

      protected StringBuilder _appendClassSignature(StringBuilder sb)
    • _appendErasedClassSignature

      protected StringBuilder _appendErasedClassSignature(StringBuilder sb)
    • _appendClassDescription

      protected StringBuilder _appendClassDescription(StringBuilder sb)
    • _appendClassName

      protected StringBuilder _appendClassName(StringBuilder sb)
    • _getFields

      protected RawField[] _getFields(boolean statics)
      Parameters:
      statics - Whether to return static methods (true) or member methods (false)
    • _getMethods

      protected RawMethod[] _getMethods(boolean statics)
      Parameters:
      statics - Whether to return static methods (true) or member methods (false)
    • _getConstructors

      protected RawConstructor[] _getConstructors()