Interface WildcardElement

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

public interface WildcardElement extends GenericElement
Represents a wildcard, for example List<?>. For compatibility, this wildcard acts like its first upper bound when used as a ClassElement.
Since:
3.1.0
Author:
Jonas Konrad
  • Method Details

    • getUpperBounds

      @NonNull @NonNull List<? extends ClassElement> getUpperBounds()
      Returns:
      The upper bounds of this wildcard. Never empty. To match this wildcard, a type must be assignable to all upper bounds (must extend all upper bounds).
    • getLowerBounds

      @NonNull @NonNull List<? extends ClassElement> getLowerBounds()
      Returns:
      The lower bounds of this wildcard. May be empty. To match this wildcard, a type must be assignable from all lower bounds (must be a supertype of all lower bounds).
    • isBounded

      default boolean isBounded()
      Is bounded wildcard - not "< ? >".
      Returns:
      true if the wildcard is bounded, false otherwise
      Since:
      4.0.0
    • findUpperType

      @NonNull static <T extends ClassElement> T findUpperType(@NonNull @NonNull List<T> bounds1, @NonNull @NonNull List<T> bounds2)
      Find the most upper type.
      Type Parameters:
      T - The class element type
      Parameters:
      bounds1 - The bounds 1
      bounds2 - The bounds 2
      Returns:
      the most upper type