Class TypeDescription.SuperTypeLoading

All Implemented Interfaces:
Iterable<TypeDefinition>, AnnotationSource, ByteCodeElement, DeclaredByType, ModifierReviewable, ModifierReviewable.ForFieldDescription, ModifierReviewable.ForMethodDescription, ModifierReviewable.ForParameterDescription, ModifierReviewable.ForTypeDefinition, ModifierReviewable.OfAbstraction, ModifierReviewable.OfByteCodeElement, ModifierReviewable.OfEnumeration, NamedElement, NamedElement.WithDescriptor, NamedElement.WithRuntimeName, TypeDefinition, TypeDescription, TypeVariableSource
Enclosing interface:
TypeDescription

public static class TypeDescription.SuperTypeLoading extends TypeDescription.AbstractBase
A delegating type description that always attempts to load the super types of a delegate type.
  • Field Details

  • Constructor Details

    • SuperTypeLoading

      public SuperTypeLoading(TypeDescription delegate, @MaybeNull ClassLoader classLoader)
      Creates a super type loading type description.
      Parameters:
      delegate - The delegate type description.
      classLoader - The class loader to use for loading a super type or null for using the boot loader.
    • SuperTypeLoading

      public SuperTypeLoading(TypeDescription delegate, @MaybeNull ClassLoader classLoader, TypeDescription.SuperTypeLoading.ClassLoadingDelegate classLoadingDelegate)
      Creates a super type loading type description.
      Parameters:
      delegate - The delegate type description.
      classLoader - The class loader to use for loading a super type or null for using the boot loader.
      classLoadingDelegate - A delegate for loading a type.
  • Method Details

    • getDeclaredAnnotations

      public AnnotationList getDeclaredAnnotations()
      Returns a list of annotations that are declared by this instance.
      Returns:
      A list of declared annotations.
    • getModifiers

      public int getModifiers()
      Returns the modifier that is described by this object.
      Returns:
      The modifier that is described by this object.
    • getTypeVariables

      public TypeList.Generic getTypeVariables()
      Returns the type variables that are declared by this element.
      Returns:
      The type variables that are declared by this element.
    • getDescriptor

      public String getDescriptor()
      Returns the descriptor of this byte code element.
      Returns:
      The descriptor of this byte code element.
    • getName

      public String getName()
      Returns the binary name of this byte code element. If no well-defined internal name is known for this element, the actual name is returned.
      Returns:
      The binary ame of this byte code element as visible from within a running Java application.
    • getSuperClass

      @MaybeNull public TypeDescription.Generic getSuperClass()
      Returns the super class of this type. A super type is only defined for non-generic types (TypeDefinition.Sort.NON_GENERIC), parameterized types (TypeDefinition.Sort.PARAMETERIZED) or generic array types (TypeDefinition.Sort.GENERIC_ARRAY) types. Interface types and the Object class do not define a super class where null is returned. Array types define Object as their direct super class.
      Returns:
      The super class of this type or null if no super class exists for this type.
    • getInterfaces

      public TypeList.Generic getInterfaces()
      Returns the interfaces that this type implements. A super type is only defined for non-generic types (TypeDefinition.Sort.NON_GENERIC), parameterized types (TypeDefinition.Sort.PARAMETERIZED) or generic array types (TypeDefinition.Sort.GENERIC_ARRAY) types.
      Returns:
      The interfaces that this type implements.
    • getDeclaredFields

      public FieldList<FieldDescription.InDefinedShape> getDeclaredFields()
      Returns the fields that this type declares. A super type is only defined for non-generic types (TypeDefinition.Sort.NON_GENERIC), parameterized types (TypeDefinition.Sort.PARAMETERIZED) or generic array types (TypeDefinition.Sort.GENERIC_ARRAY) types. Generic array types never define fields and the returned list is always empty for such types.
      Returns:
      The fields that this type declares. A super type is only defined for non-generic types (TypeDefinition.Sort.NON_GENERIC), parameterized types (TypeDefinition.Sort.PARAMETERIZED) or generic array types (TypeDefinition.Sort.GENERIC_ARRAY) types. Generic array types never define methods and the returned list is always empty for such types.
    • getDeclaredMethods

      public MethodList<MethodDescription.InDefinedShape> getDeclaredMethods()
      Returns the methods that this type declares.
      Returns:
      The methods that this type declares.
    • getStackSize

      public StackSize getStackSize()
      Returns the size of the type described by this instance. Wildcard types (TypeDefinition.Sort.WILDCARD do not have a well-defined a stack size and cause an IllegalStateException to be thrown.
      Returns:
      The size of the type described by this instance.
    • isArray

      public boolean isArray()
      Checks if the type described by this entity is an array.
      Returns:
      true if this type description represents an array.
    • isPrimitive

      public boolean isPrimitive()
      Checks if the type described by this entity is a primitive type.
      Returns:
      true if this type description represents a primitive type.
    • getComponentType

      @MaybeNull public TypeDescription getComponentType()

      Returns the component type of this type.

      Only non-generic types (TypeDefinition.Sort.NON_GENERIC) and generic array types TypeDefinition.Sort.GENERIC_ARRAY) define a component type. For other types, an IllegalStateException is thrown.

      Returns:
      The component type of this type or null if this type does not represent an array type.
    • getDeclaringType

      @MaybeNull public TypeDescription getDeclaringType()
      Returns the declaring type of this instance.
      Returns:
      The declaring type or null if no such type exists.
    • getDeclaredTypes

      public TypeList getDeclaredTypes()
      Returns a list of types that are declared by this type. This list does not normally include anonymous types but might include additional types if they are explicitly added to an instrumented type.
      Returns:
      A list of types that are declared within this type.
    • getEnclosingMethod

      @MaybeNull public MethodDescription.InDefinedShape getEnclosingMethod()
      Returns a description of the method that encloses this type. If this method is not enclosed by any type or is enclosed by the type initializer, null is returned by this method.
      Returns:
      A description of the enclosing method of this type or null if there is no such method.
    • getEnclosingType

      @MaybeNull public TypeDescription getEnclosingType()
      Returns a description of this type's enclosing type if any.
      Returns:
      A description of the enclosing type of this type or null if there is no such type.
    • getSimpleName

      public String getSimpleName()
      Returns the simple name of this type.
      Returns:
      The simple name of this type.
    • getCanonicalName

      @MaybeNull public String getCanonicalName()
      Returns the canonical name of this type if it exists.
      Returns:
      The canonical name of this type. Might be null.
    • isAnonymousType

      public boolean isAnonymousType()
      Checks if this type description represents an anonymous type.
      Returns:
      true if this type description represents an anonymous type.
    • isLocalType

      public boolean isLocalType()
      Checks if this type description represents a local type.
      Returns:
      true if this type description represents a local type.
    • getPackage

      @MaybeNull public PackageDescription getPackage()
      Returns the package of the type described by this instance or null if the described type is a primitive type or an array.
      Returns:
      The package of the type described by this instance or null if the described type is a primitive type or an array.
    • getNestHost

      public TypeDescription getNestHost()
      Returns the nest host of this type. For types prior to Java 11, this type is returned which is the default nest host.
      Returns:
      The nest host of this type.
    • getNestMembers

      public TypeList getNestMembers()
      Returns a list of members that are part of a nesting group. Prior to Java 11, a list that only contains this type is returned which is the default nest group.
      Returns:
      A list of members of this nest group.
    • getRecordComponents

      Returns the list of record components that are declared by this type. If this type is not a record, the returned list is empty.
      Returns:
      A list of record components that this type declares.
    • isRecord

      public boolean isRecord()
      Checks if this type is a Java record.
      Returns:
      true if this type is a Java record.
    • isSealed

      public boolean isSealed()
      Description copied from class: TypeDescription.AbstractBase
      Returns true if this class is a sealed class that only permitts a specified range of subclasses.
      Specified by:
      isSealed in interface TypeDescription
      Overrides:
      isSealed in class TypeDescription.AbstractBase
      Returns:
      true if this class is a sealed class that only permitts a specified range of subclasses.
    • getPermittedSubtypes

      public TypeList getPermittedSubtypes()
      Returns the list of permitted direct subclasses if this class is a sealed class. Permitted subclasses might or might not be resolvable, where unresolvable subclasses might also be missing from the list. For returned types, methods that return the class's name will always be invokable without errors. If this type is not sealed, an empty list is returned. Note that an empty list might also be returned for a sealed type, if no type permitted subtype is resolvable.
      Returns:
      The list of permitted subtypes or an empty list if this type is not sealed.
    • getClassFileVersion

      @MaybeNull public ClassFileVersion getClassFileVersion()
      Description copied from class: TypeDescription.AbstractBase
      Attempts to resolve the class file version of this type. If this description is not based on a class file or if the class file version cannot be resolved, null is returned.
      Specified by:
      getClassFileVersion in interface TypeDescription
      Overrides:
      getClassFileVersion in class TypeDescription.AbstractBase
      Returns:
      This type's class file version or null if it cannot be resolved.