001: /*
002: * Copyright 2004 Sun Microsystems, Inc. All Rights Reserved.
003: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004: *
005: * This code is free software; you can redistribute it and/or modify it
006: * under the terms of the GNU General Public License version 2 only, as
007: * published by the Free Software Foundation. Sun designates this
008: * particular file as subject to the "Classpath" exception as provided
009: * by Sun in the LICENSE file that accompanied this code.
010: *
011: * This code is distributed in the hope that it will be useful, but WITHOUT
012: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014: * version 2 for more details (a copy is included in the LICENSE file that
015: * accompanied this code).
016: *
017: * You should have received a copy of the GNU General Public License version
018: * 2 along with this work; if not, write to the Free Software Foundation,
019: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020: *
021: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022: * CA 95054 USA or visit www.sun.com if you need additional information or
023: * have any questions.
024: */
025:
026: package com.sun.mirror.type;
027:
028: import java.util.Collection;
029:
030: import com.sun.mirror.declaration.TypeDeclaration;
031:
032: /**
033: * Represents a declared type, either a class type or an interface type.
034: * This includes parameterized types such as {@code java.util.Set<String>}
035: * as well as raw types.
036: *
037: * <p> While a <tt>TypeDeclaration</tt> represents the <i>declaration</i>
038: * of a class or interface, a <tt>DeclaredType</tt> represents a class
039: * or interface <i>type</i>, the latter being a use of the former.
040: * See {@link TypeDeclaration} for more on this distinction.
041: *
042: * <p> A <tt>DeclaredType</tt> may represent a type
043: * for which details (declaration, supertypes, <i>etc.</i>) are unknown.
044: * This may be the result of a processing error, such as a missing class file,
045: * and is indicated by {@link #getDeclaration()} returning <tt>null</tt>.
046: * Other method invocations on such an unknown type will not, in general,
047: * return meaningful results.
048: *
049: * @author Joseph D. Darcy
050: * @author Scott Seligman
051: * @version 1.13 07/05/05
052: * @since 1.5
053: */
054:
055: public interface DeclaredType extends ReferenceType {
056:
057: /**
058: * Returns the declaration of this type.
059: *
060: * <p> Returns null if this type's declaration is unknown. This may
061: * be the result of a processing error, such as a missing class file.
062: *
063: * @return the declaration of this type, or null if unknown
064: */
065: TypeDeclaration getDeclaration();
066:
067: /**
068: * Returns the type that contains this type as a member.
069: * Returns <tt>null</tt> if this is a top-level type.
070: *
071: * <p> For example, the containing type of {@code O.I<S>}
072: * is the type {@code O}, and the containing type of
073: * {@code O<T>.I<S>} is the type {@code O<T>}.
074: *
075: * @return the type that contains this type,
076: * or <tt>null</tt> if this is a top-level type
077: */
078: DeclaredType getContainingType();
079:
080: /**
081: * Returns (in order) the actual type arguments of this type.
082: * For a generic type nested within another generic type
083: * (such as {@code Outer<String>.Inner<Number>}), only the type
084: * arguments of the innermost type are included.
085: *
086: * @return the actual type arguments of this type, or an empty collection
087: * if there are none
088: */
089: Collection<TypeMirror> getActualTypeArguments();
090:
091: /**
092: * Returns the interface types that are direct supertypes of this type.
093: * These are the interface types implemented or extended
094: * by this type's declaration, with any type arguments
095: * substituted in.
096: *
097: * <p> For example, the interface type extended by
098: * {@code java.util.Set<String>} is {@code java.util.Collection<String>}.
099: *
100: * @return the interface types that are direct supertypes of this type,
101: * or an empty collection if there are none
102: */
103: Collection<InterfaceType> getSuperinterfaces();
104: }
|