src/share/classes/javax/lang/model/type/DeclaredType.java

Fri, 06 Feb 2009 12:49:48 -0800

author
darcy
date
Fri, 06 Feb 2009 12:49:48 -0800
changeset 216
58fcba61a77d
parent 1
9a66ca7c79fa
child 554
9d9f26857129
permissions
-rw-r--r--

6794071: Provide exception superclass for UnknownFooExceptions
Reviewed-by: jjg

duke@1 1 /*
duke@1 2 * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
duke@1 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@1 4 *
duke@1 5 * This code is free software; you can redistribute it and/or modify it
duke@1 6 * under the terms of the GNU General Public License version 2 only, as
duke@1 7 * published by the Free Software Foundation. Sun designates this
duke@1 8 * particular file as subject to the "Classpath" exception as provided
duke@1 9 * by Sun in the LICENSE file that accompanied this code.
duke@1 10 *
duke@1 11 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@1 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@1 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@1 14 * version 2 for more details (a copy is included in the LICENSE file that
duke@1 15 * accompanied this code).
duke@1 16 *
duke@1 17 * You should have received a copy of the GNU General Public License version
duke@1 18 * 2 along with this work; if not, write to the Free Software Foundation,
duke@1 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@1 20 *
duke@1 21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@1 22 * CA 95054 USA or visit www.sun.com if you need additional information or
duke@1 23 * have any questions.
duke@1 24 */
duke@1 25
duke@1 26 package javax.lang.model.type;
duke@1 27
duke@1 28
duke@1 29 import java.util.List;
duke@1 30
duke@1 31 import javax.lang.model.element.Element;
duke@1 32 import javax.lang.model.element.TypeElement;
duke@1 33 import javax.lang.model.util.Types;
duke@1 34
duke@1 35
duke@1 36 /**
duke@1 37 * Represents a declared type, either a class type or an interface type.
duke@1 38 * This includes parameterized types such as {@code java.util.Set<String>}
duke@1 39 * as well as raw types.
duke@1 40 *
duke@1 41 * <p> While a {@code TypeElement} represents a class or interface
duke@1 42 * <i>element</i>, a {@code DeclaredType} represents a class
duke@1 43 * or interface <i>type</i>, the latter being a use
duke@1 44 * (or <i>invocation</i>) of the former.
duke@1 45 * See {@link TypeElement} for more on this distinction.
duke@1 46 *
duke@1 47 * <p> The supertypes (both class and interface types) of a declared
duke@1 48 * type may be found using the {@link
duke@1 49 * Types#directSupertypes(TypeMirror)} method. This returns the
duke@1 50 * supertypes with any type arguments substituted in.
duke@1 51 *
duke@1 52 * <p> This interface is also used to represent intersection types.
duke@1 53 * An intersection type is implicit in a program rather than being
duke@1 54 * explictly declared. For example, the bound of the type parameter
duke@1 55 * {@code <T extends Number & Runnable>}
duke@1 56 * is an intersection type. It is represented by a {@code DeclaredType}
duke@1 57 * with {@code Number} as its superclass and {@code Runnable} as its
duke@1 58 * lone superinterface.
duke@1 59 *
duke@1 60 * @author Joseph D. Darcy
duke@1 61 * @author Scott Seligman
duke@1 62 * @author Peter von der Ah&eacute;
duke@1 63 * @see TypeElement
duke@1 64 * @since 1.6
duke@1 65 */
duke@1 66 public interface DeclaredType extends ReferenceType {
duke@1 67
duke@1 68 /**
duke@1 69 * Returns the element corresponding to this type.
duke@1 70 *
duke@1 71 * @return the element corresponding to this type
duke@1 72 */
duke@1 73 Element asElement();
duke@1 74
duke@1 75 /**
duke@1 76 * Returns the type of the innermost enclosing instance or a
duke@1 77 * {@code NoType} of kind {@code NONE} if there is no enclosing
duke@1 78 * instance. Only types corresponding to inner classes have an
duke@1 79 * enclosing instance.
duke@1 80 *
duke@1 81 * @return a type mirror for the enclosing type
duke@1 82 * @jls3 8.1.3 Inner Classes and Enclosing Instances
duke@1 83 * @jls3 15.9.2 Determining Enclosing Instances
duke@1 84 */
duke@1 85 TypeMirror getEnclosingType();
duke@1 86
duke@1 87 /**
duke@1 88 * Returns the actual type arguments of this type.
duke@1 89 * For a type nested within a parameterized type
duke@1 90 * (such as {@code Outer<String>.Inner<Number>}), only the type
duke@1 91 * arguments of the innermost type are included.
duke@1 92 *
duke@1 93 * @return the actual type arguments of this type, or an empty list
duke@1 94 * if none
duke@1 95 */
duke@1 96 List<? extends TypeMirror> getTypeArguments();
duke@1 97 }

mercurial