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