src/share/classes/com/sun/mirror/declaration/TypeDeclaration.java

Tue, 16 Sep 2008 18:35:18 -0700

author
jjg
date
Tue, 16 Sep 2008 18:35:18 -0700
changeset 113
eff38cc97183
parent 1
9a66ca7c79fa
child 331
d043adadc8b6
permissions
-rw-r--r--

6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
Reviewed-by: darcy, mcimadamore

duke@1 1 /*
duke@1 2 * Copyright 2004 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 com.sun.mirror.declaration;
duke@1 27
duke@1 28
duke@1 29 import java.util.Collection;
duke@1 30
duke@1 31 import com.sun.mirror.type.*;
duke@1 32
duke@1 33
duke@1 34 /**
duke@1 35 * Represents the declaration of a class or interface.
duke@1 36 * Provides access to information about the type and its members.
duke@1 37 * Note that an {@linkplain EnumDeclaration enum} is a kind of class,
duke@1 38 * and an {@linkplain AnnotationTypeDeclaration annotation type} is
duke@1 39 * a kind of interface.
duke@1 40 *
duke@1 41 * <p> <a name="DECL_VS_TYPE"></a>
duke@1 42 * While a <tt>TypeDeclaration</tt> represents the <i>declaration</i>
duke@1 43 * of a class or interface, a {@link DeclaredType} represents a class
duke@1 44 * or interface <i>type</i>, the latter being a use
duke@1 45 * (or <i>invocation</i>) of the former.
duke@1 46 * The distinction is most apparent with generic types,
duke@1 47 * for which a single declaration can define a whole
duke@1 48 * family of types. For example, the declaration of
duke@1 49 * {@code java.util.Set} corresponds to the parameterized types
duke@1 50 * {@code java.util.Set<String>} and {@code java.util.Set<Number>}
duke@1 51 * (and many others), and to the raw type {@code java.util.Set}.
duke@1 52 *
duke@1 53 * <p> {@link com.sun.mirror.util.DeclarationFilter}
duke@1 54 * provides a simple way to select just the items of interest
duke@1 55 * when a method returns a collection of declarations.
duke@1 56 *
duke@1 57 * @author Joseph D. Darcy
duke@1 58 * @author Scott Seligman
duke@1 59 *
duke@1 60 * @see DeclaredType
duke@1 61 * @since 1.5
duke@1 62 */
duke@1 63
duke@1 64 public interface TypeDeclaration extends MemberDeclaration {
duke@1 65
duke@1 66 /**
duke@1 67 * Returns the package within which this type is declared.
duke@1 68 *
duke@1 69 * @return the package within which this type is declared
duke@1 70 */
duke@1 71 PackageDeclaration getPackage();
duke@1 72
duke@1 73 /**
duke@1 74 * Returns the fully qualified name of this class or interface
duke@1 75 * declaration. More precisely, it returns the <i>canonical</i>
duke@1 76 * name.
duke@1 77 * The name of a generic type does not include any reference
duke@1 78 * to its formal type parameters.
duke@1 79 * For example, the the fully qualified name of the interface declaration
duke@1 80 * {@code java.util.Set<E>} is <tt>"java.util.Set"</tt>.
duke@1 81 *
duke@1 82 * @return the fully qualified name of this class or interface declaration
duke@1 83 */
duke@1 84 String getQualifiedName();
duke@1 85
duke@1 86 /**
duke@1 87 * Returns the formal type parameters of this class or interface.
duke@1 88 *
duke@1 89 * @return the formal type parameters, or an empty collection
duke@1 90 * if there are none
duke@1 91 */
duke@1 92 Collection<TypeParameterDeclaration> getFormalTypeParameters();
duke@1 93
duke@1 94 /**
duke@1 95 * Returns the interface types directly implemented by this class
duke@1 96 * or extended by this interface.
duke@1 97 *
duke@1 98 * @return the interface types directly implemented by this class
duke@1 99 * or extended by this interface, or an empty collection if there are none
duke@1 100 *
duke@1 101 * @see com.sun.mirror.util.DeclarationFilter
duke@1 102 */
duke@1 103 Collection<InterfaceType> getSuperinterfaces();
duke@1 104
duke@1 105 /**
duke@1 106 * Returns the fields that are directly declared by this class or
duke@1 107 * interface. Includes enum constants.
duke@1 108 *
duke@1 109 * @return the fields that are directly declared,
duke@1 110 * or an empty collection if there are none
duke@1 111 *
duke@1 112 * @see com.sun.mirror.util.DeclarationFilter
duke@1 113 */
duke@1 114 Collection<FieldDeclaration> getFields();
duke@1 115
duke@1 116 /**
duke@1 117 * Returns the methods that are directly declared by this class or
duke@1 118 * interface. Includes annotation type elements. Excludes
duke@1 119 * implicitly declared methods of an interface, such as
duke@1 120 * <tt>toString</tt>, that correspond to the methods of
duke@1 121 * <tt>java.lang.Object</tt>.
duke@1 122 *
duke@1 123 * @return the methods that are directly declared,
duke@1 124 * or an empty collection if there are none
duke@1 125 *
duke@1 126 * @see com.sun.mirror.util.DeclarationFilter
duke@1 127 */
duke@1 128 Collection<? extends MethodDeclaration> getMethods();
duke@1 129
duke@1 130 /**
duke@1 131 * Returns the declarations of the nested classes and interfaces
duke@1 132 * that are directly declared by this class or interface.
duke@1 133 *
duke@1 134 * @return the declarations of the nested classes and interfaces,
duke@1 135 * or an empty collection if there are none
duke@1 136 *
duke@1 137 * @see com.sun.mirror.util.DeclarationFilter
duke@1 138 */
duke@1 139 Collection<TypeDeclaration> getNestedTypes();
duke@1 140 }

mercurial