Class ResolvedType

    • Field Detail

      • 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 java.lang.Class<?> _erasedType
      • _typeBindings

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

      • ResolvedType

        protected ResolvedType​(java.lang.Class<?> cls,
                               TypeBindings bindings)
    • Method Detail

      • 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​(java.lang.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 java.lang.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 java.util.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 java.util.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 java.util.List<ResolvedType> typeParametersFor​(java.lang.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​(java.lang.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​(java.lang.Class<?> type)
      • getConstructors

        public java.util.List<RawConstructor> getConstructors()
      • getMemberFields

        public java.util.List<RawField> getMemberFields()
      • getMemberMethods

        public java.util.List<RawMethod> getMemberMethods()
      • getStaticFields

        public java.util.List<RawField> getStaticFields()
      • getStaticMethods

        public java.util.List<RawMethod> getStaticMethods()
      • getSignature

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

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

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

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

        public abstract java.lang.StringBuilder appendBriefDescription​(java.lang.StringBuilder sb)
      • appendFullDescription

        public abstract java.lang.StringBuilder appendFullDescription​(java.lang.StringBuilder sb)
      • appendSignature

        public abstract java.lang.StringBuilder appendSignature​(java.lang.StringBuilder sb)
      • appendErasedSignature

        public abstract java.lang.StringBuilder appendErasedSignature​(java.lang.StringBuilder sb)
      • toString

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

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

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • _appendClassSignature

        protected java.lang.StringBuilder _appendClassSignature​(java.lang.StringBuilder sb)
      • _appendErasedClassSignature

        protected java.lang.StringBuilder _appendErasedClassSignature​(java.lang.StringBuilder sb)
      • _appendClassDescription

        protected java.lang.StringBuilder _appendClassDescription​(java.lang.StringBuilder sb)
      • _appendClassName

        protected java.lang.StringBuilder _appendClassName​(java.lang.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)