Interface GenericElement

All Superinterfaces:
AnnotatedElement, AnnotationMetadata, AnnotationMetadataDelegate, AnnotationMetadataProvider, AnnotationSource, ClassElement, Described, Element, MutableAnnotationMetadataDelegate<Element>, Named, TypedElement
All Known Subinterfaces:
GenericPlaceholderElement, WildcardElement

public interface GenericElement extends ClassElement
Represents a generic element that can appear as a type argument.
Since:
4.0.0
Author:
Denis Stepanov
  • Method Details

    • getGenericNativeType

      @NonNull default @NonNull Object getGenericNativeType()
      The native type that represents the generic element. It is expected that the generic element representing `T` extends java.lang.Number` should be equal to the class element `java.lang.Number`. To find matching placeholders we can use this method to match the native generic type.
      Returns:
      The generic native type
    • getGenericTypeAnnotationMetadata

      @NonNull default @NonNull MutableAnnotationMetadataDelegate<AnnotationMetadata> getGenericTypeAnnotationMetadata()
      Returns the type parameter annotations. Added to this generic element by: - The declaration of the type variable ElementType.TYPE_PARAMETER - The use of the type ElementType.TYPE
      Returns:
      the type annotations
    • getResolved

      default Optional<ClassElement> getResolved()
      In some cases the class element can be a resolved as a generic element and this element should return the actual type that is generic element is representing.
      Returns:
      The resolved value of the generic element.
      Since:
      4.2.0
    • resolved

      default ClassElement resolved()
      Tries to resolve underneath type using getResolved() or returns this type otherwise.
      Returns:
      The resolved value of the generic element or this type.
      Since:
      4.2.0