1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/classes/javax/lang/model/type/DeclaredType.java Sat Dec 01 00:00:00 2007 +0000 1.3 @@ -0,0 +1,97 @@ 1.4 +/* 1.5 + * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. Sun designates this 1.11 + * particular file as subject to the "Classpath" exception as provided 1.12 + * by Sun in the LICENSE file that accompanied this code. 1.13 + * 1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.17 + * version 2 for more details (a copy is included in the LICENSE file that 1.18 + * accompanied this code). 1.19 + * 1.20 + * You should have received a copy of the GNU General Public License version 1.21 + * 2 along with this work; if not, write to the Free Software Foundation, 1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.23 + * 1.24 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 1.25 + * CA 95054 USA or visit www.sun.com if you need additional information or 1.26 + * have any questions. 1.27 + */ 1.28 + 1.29 +package javax.lang.model.type; 1.30 + 1.31 + 1.32 +import java.util.List; 1.33 + 1.34 +import javax.lang.model.element.Element; 1.35 +import javax.lang.model.element.TypeElement; 1.36 +import javax.lang.model.util.Types; 1.37 + 1.38 + 1.39 +/** 1.40 + * Represents a declared type, either a class type or an interface type. 1.41 + * This includes parameterized types such as {@code java.util.Set<String>} 1.42 + * as well as raw types. 1.43 + * 1.44 + * <p> While a {@code TypeElement} represents a class or interface 1.45 + * <i>element</i>, a {@code DeclaredType} represents a class 1.46 + * or interface <i>type</i>, the latter being a use 1.47 + * (or <i>invocation</i>) of the former. 1.48 + * See {@link TypeElement} for more on this distinction. 1.49 + * 1.50 + * <p> The supertypes (both class and interface types) of a declared 1.51 + * type may be found using the {@link 1.52 + * Types#directSupertypes(TypeMirror)} method. This returns the 1.53 + * supertypes with any type arguments substituted in. 1.54 + * 1.55 + * <p> This interface is also used to represent intersection types. 1.56 + * An intersection type is implicit in a program rather than being 1.57 + * explictly declared. For example, the bound of the type parameter 1.58 + * {@code <T extends Number & Runnable>} 1.59 + * is an intersection type. It is represented by a {@code DeclaredType} 1.60 + * with {@code Number} as its superclass and {@code Runnable} as its 1.61 + * lone superinterface. 1.62 + * 1.63 + * @author Joseph D. Darcy 1.64 + * @author Scott Seligman 1.65 + * @author Peter von der Ahé 1.66 + * @see TypeElement 1.67 + * @since 1.6 1.68 + */ 1.69 +public interface DeclaredType extends ReferenceType { 1.70 + 1.71 + /** 1.72 + * Returns the element corresponding to this type. 1.73 + * 1.74 + * @return the element corresponding to this type 1.75 + */ 1.76 + Element asElement(); 1.77 + 1.78 + /** 1.79 + * Returns the type of the innermost enclosing instance or a 1.80 + * {@code NoType} of kind {@code NONE} if there is no enclosing 1.81 + * instance. Only types corresponding to inner classes have an 1.82 + * enclosing instance. 1.83 + * 1.84 + * @return a type mirror for the enclosing type 1.85 + * @jls3 8.1.3 Inner Classes and Enclosing Instances 1.86 + * @jls3 15.9.2 Determining Enclosing Instances 1.87 + */ 1.88 + TypeMirror getEnclosingType(); 1.89 + 1.90 + /** 1.91 + * Returns the actual type arguments of this type. 1.92 + * For a type nested within a parameterized type 1.93 + * (such as {@code Outer<String>.Inner<Number>}), only the type 1.94 + * arguments of the innermost type are included. 1.95 + * 1.96 + * @return the actual type arguments of this type, or an empty list 1.97 + * if none 1.98 + */ 1.99 + List<? extends TypeMirror> getTypeArguments(); 1.100 +}