< prev index next >

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

Print this page




  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package java.lang.reflect;
  27 
  28 /**
  29  * {@code AnnotatedType} represents the potentially annotated use of a type in
  30  * the program currently running in this VM. The use may be of any type in the
  31  * Java programming language, including an array type, a parameterized type, a
  32  * type variable, or a wildcard type.
  33  *
  34  * @since 1.8
  35  */
  36 public interface AnnotatedType extends AnnotatedElement {
  37 
  38     /**





























  39      * Returns the underlying type that this annotated type represents.
  40      *
  41      * @return the type this annotated type represents
  42      */
  43     public Type getType();
  44 }


  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package java.lang.reflect;
  27 
  28 /**
  29  * {@code AnnotatedType} represents the potentially annotated use of a type in
  30  * the program currently running in this VM. The use may be of any type in the
  31  * Java programming language, including an array type, a parameterized type, a
  32  * type variable, or a wildcard type.
  33  *
  34  * @since 1.8
  35  */
  36 public interface AnnotatedType extends AnnotatedElement {
  37 
  38     /**
  39      * Returns the potentially annotated type that this type is a member of, if
  40      * this type represents a nested type. For example, if this type is
  41      * {@code @TA O<T>.I<S>}, return a representation of {@code @TA O<T>}.
  42      *
  43      * <p>Returns {@code null} if this {@code AnnotatedType} represents a
  44      *     top-level type, or a local or anonymous class, or a primitive type, or
  45      *     void.
  46      *
  47      * <p>Returns {@code null} if this {@code AnnotatedType} is an instance of
  48      *     {@code AnnotatedArrayType}, {@code AnnotatedTypeVariable}, or
  49      *     {@code AnnotatedWildcardType}.
  50      *
  51      * @return an {@code AnnotatedType} object representing the potentially
  52      *     annotated type that this type is a member of, or {@code null}
  53      * @throws TypeNotPresentException if the owner type
  54      *     refers to a non-existent type declaration
  55      * @throws MalformedParameterizedTypeException if the owner type
  56      *     refers to a parameterized type that cannot be instantiated
  57      *     for any reason
  58      * @throws UnsupportedOperationException if the {@code getAnnotatedOwnerType}
  59      *     operation is not supported by the implementation of this interface
  60      *
  61      * @since 1.9
  62      */
  63     default AnnotatedType getAnnotatedOwnerType() {
  64         throw new UnsupportedOperationException("getAnnotatedOwnerType() is not supported by this implementation");
  65     }
  66 
  67     /**
  68      * Returns the underlying type that this annotated type represents.
  69      *
  70      * @return the type this annotated type represents
  71      */
  72     public Type getType();
  73 }
< prev index next >