Interface GenericPlaceholderElement

All Superinterfaces:
AnnotatedElement, AnnotationMetadata, AnnotationMetadataDelegate, AnnotationMetadataProvider, AnnotationSource, ClassElement, Described, Element, GenericElement, MutableAnnotationMetadataDelegate<Element>, Named, TypedElement

public interface GenericPlaceholderElement extends GenericElement
Represents a generic placeholder in source code. A placeholder is a generic type that has not yet had the type bound yet – List<T> has a generic placeholder, whilst List<String> does not.

For compatibility, this a GenericPlaceholderElement acts like its first upper bound when used as a ClassElement.

Since:
3.1.0
Author:
Jonas Konrad, graemerocher
  • Method Details

    • getBounds

      @NonNull @NonNull List<? extends ClassElement> getBounds()
      Returns the bounds of this the generic placeholder empty. Always returns a non-empty list.
      Returns:
      The bounds declared for this type variable.
    • getVariableName

      @NonNull @NonNull String getVariableName()
      Returns:
      The name of the placeholder variable.
    • getDeclaringElement

      Optional<Element> getDeclaringElement()
      Returns:
      The element declaring this variable, if it can be determined. Must be either a method or a class.
    • getRequiredDeclaringElement

      @NonNull default @NonNull Element getRequiredDeclaringElement()
      Returns:
      The required element declaring this variable, if it can be determined. Must be either a method or a class. Or throws an exception.
      Since:
      4.0.0
    • getResolved

      @NextMajorVersion("Remove this method. There is an equivalent in the super class.") default Optional<ClassElement> getResolved()
      In some cases the class element can be a resolved placeholder. We want to keep the placeholder to reference the type annotations etc.
      Specified by:
      getResolved in interface GenericElement
      Returns:
      The resolved value of the placeholder.
      Since:
      4.0.0