Tue, 25 May 2010 15:54:51 -0700
6943119: Rebrand source copyright notices
Reviewed-by: darcy
duke@1 | 1 | /* |
ohair@554 | 2 | * Copyright (c) 2005, 2009, Oracle and/or its affiliates. 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 |
ohair@554 | 7 | * published by the Free Software Foundation. Oracle designates this |
duke@1 | 8 | * particular file as subject to the "Classpath" exception as provided |
ohair@554 | 9 | * by Oracle 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 | * |
ohair@554 | 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ohair@554 | 22 | * or visit www.oracle.com if you need additional information or have any |
ohair@554 | 23 | * questions. |
duke@1 | 24 | */ |
duke@1 | 25 | |
duke@1 | 26 | package javax.lang.model.element; |
duke@1 | 27 | |
duke@1 | 28 | import java.util.List; |
duke@1 | 29 | import javax.lang.model.type.*; |
duke@1 | 30 | import javax.lang.model.util.*; |
duke@1 | 31 | |
duke@1 | 32 | /** |
duke@1 | 33 | * Represents a class or interface program element. Provides access |
duke@1 | 34 | * to information about the type and its members. Note that an enum |
duke@1 | 35 | * type is a kind of class and an annotation type is a kind of |
duke@1 | 36 | * interface. |
duke@1 | 37 | * |
duke@1 | 38 | * <p> <a name="ELEM_VS_TYPE"></a> |
duke@1 | 39 | * While a {@code TypeElement} represents a class or interface |
duke@1 | 40 | * <i>element</i>, a {@link DeclaredType} represents a class |
duke@1 | 41 | * or interface <i>type</i>, the latter being a use |
duke@1 | 42 | * (or <i>invocation</i>) of the former. |
duke@1 | 43 | * The distinction is most apparent with generic types, |
duke@1 | 44 | * for which a single element can define a whole |
duke@1 | 45 | * family of types. For example, the element |
duke@1 | 46 | * {@code java.util.Set} corresponds to the parameterized types |
duke@1 | 47 | * {@code java.util.Set<String>} and {@code java.util.Set<Number>} |
duke@1 | 48 | * (and many others), and to the raw type {@code java.util.Set}. |
duke@1 | 49 | * |
duke@1 | 50 | * <p> Each method of this interface that returns a list of elements |
duke@1 | 51 | * will return them in the order that is natural for the underlying |
duke@1 | 52 | * source of program information. For example, if the underlying |
duke@1 | 53 | * source of information is Java source code, then the elements will be |
duke@1 | 54 | * returned in source code order. |
duke@1 | 55 | * |
duke@1 | 56 | * @author Joseph D. Darcy |
duke@1 | 57 | * @author Scott Seligman |
duke@1 | 58 | * @author Peter von der Ahé |
duke@1 | 59 | * @see DeclaredType |
duke@1 | 60 | * @since 1.6 |
duke@1 | 61 | */ |
darcy@224 | 62 | public interface TypeElement extends Element, Parameterizable, QualifiedNameable { |
darcy@411 | 63 | /** |
darcy@411 | 64 | * {@inheritDoc} |
darcy@411 | 65 | * |
darcy@411 | 66 | * <p> Note that as a particular instance of the {@linkplain |
darcy@411 | 67 | * javax.lang.model.element general accuracy requirements} and the |
darcy@411 | 68 | * ordering behavior required of this interface, the list of |
darcy@411 | 69 | * enclosed elements will be returned in the natural order for the |
darcy@411 | 70 | * originating source of information about the type. For example, |
darcy@411 | 71 | * if the information about the type is originating from a source |
darcy@411 | 72 | * file, the elements will be returned in source code order. |
darcy@411 | 73 | * (However, in that case the the ordering of synthesized |
darcy@411 | 74 | * elements, such as a default constructor, is not specified.) |
darcy@411 | 75 | * |
darcy@411 | 76 | * @return the enclosed elements in proper order, or an empty list if none |
darcy@411 | 77 | */ |
darcy@411 | 78 | List<? extends Element> getEnclosedElements(); |
duke@1 | 79 | |
duke@1 | 80 | /** |
duke@1 | 81 | * Returns the <i>nesting kind</i> of this type element. |
duke@1 | 82 | * |
duke@1 | 83 | * @return the nesting kind of this type element |
duke@1 | 84 | */ |
duke@1 | 85 | NestingKind getNestingKind(); |
duke@1 | 86 | |
duke@1 | 87 | /** |
duke@1 | 88 | * Returns the fully qualified name of this type element. |
duke@1 | 89 | * More precisely, it returns the <i>canonical</i> name. |
duke@1 | 90 | * For local and anonymous classes, which do not have canonical names, |
duke@1 | 91 | * an empty name is returned. |
duke@1 | 92 | * |
duke@1 | 93 | * <p>The name of a generic type does not include any reference |
duke@1 | 94 | * to its formal type parameters. |
duke@1 | 95 | * For example, the fully qualified name of the interface |
duke@1 | 96 | * {@code java.util.Set<E>} is "{@code java.util.Set}". |
duke@1 | 97 | * Nested types use "{@code .}" as a separator, as in |
duke@1 | 98 | * "{@code java.util.Map.Entry}". |
duke@1 | 99 | * |
duke@1 | 100 | * @return the fully qualified name of this class or interface, or |
duke@1 | 101 | * an empty name if none |
duke@1 | 102 | * |
duke@1 | 103 | * @see Elements#getBinaryName |
duke@1 | 104 | * @jls3 6.7 Fully Qualified Names and Canonical Names |
duke@1 | 105 | */ |
duke@1 | 106 | Name getQualifiedName(); |
duke@1 | 107 | |
duke@1 | 108 | /** |
duke@1 | 109 | * Returns the direct superclass of this type element. |
duke@1 | 110 | * If this type element represents an interface or the class |
duke@1 | 111 | * {@code java.lang.Object}, then a {@link NoType} |
duke@1 | 112 | * with kind {@link TypeKind#NONE NONE} is returned. |
duke@1 | 113 | * |
duke@1 | 114 | * @return the direct superclass, or a {@code NoType} if there is none |
duke@1 | 115 | */ |
duke@1 | 116 | TypeMirror getSuperclass(); |
duke@1 | 117 | |
duke@1 | 118 | /** |
duke@1 | 119 | * Returns the interface types directly implemented by this class |
duke@1 | 120 | * or extended by this interface. |
duke@1 | 121 | * |
duke@1 | 122 | * @return the interface types directly implemented by this class |
duke@1 | 123 | * or extended by this interface, or an empty list if there are none |
duke@1 | 124 | */ |
duke@1 | 125 | List<? extends TypeMirror> getInterfaces(); |
duke@1 | 126 | |
duke@1 | 127 | /** |
duke@1 | 128 | * Returns the formal type parameters of this type element |
duke@1 | 129 | * in declaration order. |
duke@1 | 130 | * |
duke@1 | 131 | * @return the formal type parameters, or an empty list |
duke@1 | 132 | * if there are none |
duke@1 | 133 | */ |
duke@1 | 134 | List<? extends TypeParameterElement> getTypeParameters(); |
duke@1 | 135 | } |