Class TypeDescription.AbstractBase.OfSimpleType.WithDelegation

    • Constructor Detail

      • WithDelegation

        public WithDelegation()
    • Method Detail

      • delegate

        protected abstract TypeDescription delegate()
        Returns the delegate type description to this type instance.
        Returns:
        The delegate type description.
      • getDeclaringType

        @MaybeNull
        public TypeDescription getDeclaringType()
        Returns the declaring type of this instance.
        Returns:
        The declaring type or null if no such type exists.
      • 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.
      • 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.
      • 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.
      • getDeclaredAnnotations

        public AnnotationList getDeclaredAnnotations()
        Returns a list of annotations that are declared by this instance.
        Returns:
        A list of declared annotations.
      • 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.
      • getModifiers

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

        public int getActualModifiers​(boolean superFlag)
        Description copied from class: TypeDescription.AbstractBase
        Returns the type's actual modifiers as present in the class file. For example, a type cannot be private. but it modifiers might reflect this property nevertheless if a class was defined as a private inner class. The returned modifiers take also into account if the type is marked as Deprecated. Anonymous classes that are enclosed in a static method or the type initializer are additionally marked as final as it is also done by the Java compiler.
        Specified by:
        getActualModifiers in interface TypeDescription
        Overrides:
        getActualModifiers in class TypeDescription.AbstractBase
        Parameters:
        superFlag - true if the modifier's super flag should be set.
        Returns:
        The type's actual modifiers.
      • 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

        public RecordComponentList<RecordComponentDescription.InDefinedShape> 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.
      • 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.