Interface WildcardType

All Superinterfaces:
AnnotationTarget, Type

public interface WildcardType extends Type
A wildcard type. May have 3 forms:
  • ? extends Number: has an upper bound
  • ? super Number: has a lower bound
  • ?: unbounded, has an implicit upper bound of java.lang.Object
Note that ? is equivalent to ? extends Object and is represented as such. Therefore, either upperBound() or lowerBound() always returns non-null.
  • Method Details

    • upperBound

      Type upperBound()
      Returns the upper bound of this wildcard type. Returns null if this wildcard type does not have an upper bound.
      Returns:
      upper bound of this wildcard type, or null if this wildcard type does not have an upper bound
    • lowerBound

      Type lowerBound()
      Returns the lower bound of this wildcard type. Returns null if this wildcard type does not have a lower bound.
      Returns:
      lower bound of this wildcard type, or null if this wildcard type does not have a lower bound
    • kind

      default Type.Kind kind()
      Description copied from interface: Type
      Returns the kind of this type.
      Specified by:
      kind in interface Type
      Returns:
      the kind of this type
    • asWildcardType

      default WildcardType asWildcardType()
      Description copied from interface: Type
      Returns this type as a wildcard type.
      Specified by:
      asWildcardType in interface Type
      Returns:
      this wildcard type, never null