-
- All Superinterfaces:
-
AnnotatedElement
- All Known Subinterfaces:
-
AnnotatedArrayType,AnnotatedParameterizedType,AnnotatedTypeVariable,AnnotatedWildcardType
public interface AnnotatedType extends AnnotatedElement
AnnotatedType表示当前在此VM中运行的程序中可能注释的使用类型。 使用可能是Java编程语言中的任何类型,包括数组类型,参数化类型,类型变量或通配符类型。- 从以下版本开始:
- 1.8
-
-
方法摘要
所有方法 接口方法 抽象方法 Default Methods Modifier and Type 方法 描述 default AnnotatedTypegetAnnotatedOwnerType()如果此类型表示嵌套类型,则返回此类型为其成员的潜在注释类型。TypegetType()返回此注释类型表示的基础类型。-
Methods inherited from interface java.lang.reflect.AnnotatedElement
getAnnotation, getAnnotations, getAnnotationsByType, getDeclaredAnnotation, getDeclaredAnnotations, getDeclaredAnnotationsByType, isAnnotationPresent
-
-
-
-
方法详细信息
-
getAnnotatedOwnerType
default AnnotatedType getAnnotatedOwnerType()
如果此类型表示嵌套类型,则返回此类型为其成员的潜在注释类型。 例如,如果该类型是@TA O<T>.I<S>,返回的表示@TA O<T>。返回
null如果这个AnnotatedType表示顶级类型,或本地或匿名类,或原始类型或void。返回
null如果AnnotatedType是实例AnnotatedArrayType,AnnotatedTypeVariable,或AnnotatedWildcardType。- 实现要求:
-
此默认实现返回
null,不执行其他操作。 - 结果
-
一个
AnnotatedType对象,表示该类型是其成员的潜在注释类型,或null - 异常
-
TypeNotPresentException- 如果所有者类型引用不存在的类型声明 -
MalformedParameterizedTypeException- 如果所有者类型引用了由于任何原因无法实例化的参数化类型 - 从以下版本开始:
- 9
-
getType
Type getType()
返回此注释类型表示的基础类型。- 结果
- 该注释类型表示的类型
-
-