public interface ParameterizedType extends Type
参数化类型在第一次通过反射方法需要时创建,如本包所指定的。 当创建参数化类型p时,p实例化的泛型类型声明被解析,并且p的所有类型参数都是递归创建的。 见TypeVariable关于类型变量创建过程的详细信息。 重复创建参数化类型无效。
实现此接口的类的实例必须实现一个equals()方法,它等同于共享相同泛型类型声明的任何两个实例并具有相等的类型参数。
| Modifier and Type | Method and Description |
|---|---|
Type[] |
getActualTypeArguments()
返回一个表示此类型的实际类型参数的数组
Type对象。
|
Type |
getOwnerType()
返回一个
Type对象,表示此类型为其成员的类型。
|
Type |
getRawType()
返回表示声明此类型的类或接口的
Type对象。
|
getTypeNameType[] getActualTypeArguments()
Type对象。
请注意,在某些情况下,返回的数组为空。 如果此类型表示嵌套在参数化类型中的非参数化类型,则可能会发生这种情况。
Type对象,表示此类型的实际类型参数
TypeNotPresentException - 如果任何实际的类型参数是指不存在的类型声明
MalformedParameterizedTypeException - 如果任何实际类型参数是指由于任何原因而无法实例化的参数化类型
Type getRawType()
Type对象。
Type对象
Type getOwnerType()
Type对象。
例如,如果此类型为O<T>.I<S> ,则返回O<T>的O<T> 。
如果此类型是顶级类型,则返回null 。
Type对象,表示此类型是其成员的类型。
如果此类型是顶级类型,则返回null
TypeNotPresentException - 如果所有者类型引用不存在的类型声明
MalformedParameterizedTypeException - 如果所有者类型是指由于任何原因无法实例化的参数化类型
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.