Most visited

Recently visited

Added in API level 1

WildcardType

public interface WildcardType
implements Type

java.lang.reflect.WildcardType


WildcardType表示一个通配符型表达,如 ?? extends Number ,或 ? super Integer

Summary

Public methods

abstract Type[] getLowerBounds()

返回表示此类型变量下限的 Type对象的数组。

abstract Type[] getUpperBounds()

返回表示此类型变量上限的 Type对象的数组。

Public methods

getLowerBounds

Added in API level 1
Type[] getLowerBounds ()

返回表示此类型变量下限的Type对象数组。 请注意,如果没有明确声明下限,则下限是null的类型。 在这种情况下,返回一个零长度的数组。

对于每个下限B:

  • if B is a parameterized type or a type variable, it is created, (see ParameterizedType for the details of the creation process for parameterized types).
  • Otherwise, B is resolved.

Returns
Type[] an array of Types representing the lower bound(s) of this type variable
Throws
TypeNotPresentException if any of the bounds refers to a non-existent type declaration
MalformedParameterizedTypeException if any of the bounds refer to a parameterized type that cannot be instantiated for any reason

getUpperBounds

Added in API level 1
Type[] getUpperBounds ()

返回表示此类型变量上限的Type对象的数组。 请注意,如果没有明确声明上限,则上限为Object

对于每个上限B:

  • if B is a parameterized type or a type variable, it is created, (see ParameterizedType for the details of the creation process for parameterized types).
  • Otherwise, B is resolved.

Returns
Type[] an array of Types representing the upper bound(s) of this type variable
Throws
TypeNotPresentException if any of the bounds refers to a non-existent type declaration
MalformedParameterizedTypeException if any of the bounds refer to a parameterized type that cannot be instantiated for any reason

Hooray!