< prev index next >

src/java.base/share/classes/java/lang/reflect/AnnotatedType.java

Print this page

        

*** 34,43 **** --- 34,72 ---- * @since 1.8 */ public interface AnnotatedType extends AnnotatedElement { /** + * Returns the potentially annotated type that this type is a member of, if + * this type represents a nested type. For example, if this type is + * {@code @TA O<T>.I<S>}, return a representation of {@code @TA O<T>}. + * + * <p>Returns {@code null} if this {@code AnnotatedType} represents a + * top-level type, or a local or anonymous class, or a primitive type, or + * void. + * + * <p>Returns {@code null} if this {@code AnnotatedType} is an instance of + * {@code AnnotatedArrayType}, {@code AnnotatedTypeVariable}, or + * {@code AnnotatedWildcardType}. + * + * @return an {@code AnnotatedType} object representing the potentially + * annotated type that this type is a member of, or {@code null} + * @throws TypeNotPresentException if the owner type + * refers to a non-existent type declaration + * @throws MalformedParameterizedTypeException if the owner type + * refers to a parameterized type that cannot be instantiated + * for any reason + * @throws UnsupportedOperationException if the {@code getAnnotatedOwnerType} + * operation is not supported by the implementation of this interface + * + * @since 1.9 + */ + default AnnotatedType getAnnotatedOwnerType() { + throw new UnsupportedOperationException("getAnnotatedOwnerType() is not supported by this implementation"); + } + + /** * Returns the underlying type that this annotated type represents. * * @return the type this annotated type represents */ public Type getType();
< prev index next >