duke@1: /* darcy@1181: * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. duke@1: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@1: * duke@1: * This code is free software; you can redistribute it and/or modify it duke@1: * under the terms of the GNU General Public License version 2 only, as ohair@554: * published by the Free Software Foundation. Oracle designates this duke@1: * particular file as subject to the "Classpath" exception as provided ohair@554: * by Oracle in the LICENSE file that accompanied this code. duke@1: * duke@1: * This code is distributed in the hope that it will be useful, but WITHOUT duke@1: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@1: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@1: * version 2 for more details (a copy is included in the LICENSE file that duke@1: * accompanied this code). duke@1: * duke@1: * You should have received a copy of the GNU General Public License version duke@1: * 2 along with this work; if not, write to the Free Software Foundation, duke@1: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@1: * ohair@554: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ohair@554: * or visit www.oracle.com if you need additional information or have any ohair@554: * questions. duke@1: */ duke@1: duke@1: package javax.lang.model.element; duke@1: duke@1: import java.util.List; duke@1: import javax.lang.model.type.*; duke@1: import javax.lang.model.util.*; duke@1: duke@1: /** duke@1: * Represents a class or interface program element. Provides access duke@1: * to information about the type and its members. Note that an enum duke@1: * type is a kind of class and an annotation type is a kind of duke@1: * interface. duke@1: * duke@1: *
duke@1: * While a {@code TypeElement} represents a class or interface
duke@1: * element, a {@link DeclaredType} represents a class
duke@1: * or interface type, the latter being a use
duke@1: * (or invocation) of the former.
duke@1: * The distinction is most apparent with generic types,
duke@1: * for which a single element can define a whole
duke@1: * family of types. For example, the element
duke@1: * {@code java.util.Set} corresponds to the parameterized types
duke@1: * {@code java.util.Set Each method of this interface that returns a list of elements
duke@1: * will return them in the order that is natural for the underlying
duke@1: * source of program information. For example, if the underlying
duke@1: * source of information is Java source code, then the elements will be
duke@1: * returned in source code order.
duke@1: *
duke@1: * @author Joseph D. Darcy
duke@1: * @author Scott Seligman
duke@1: * @author Peter von der Ahé
duke@1: * @see DeclaredType
duke@1: * @since 1.6
duke@1: */
darcy@224: public interface TypeElement extends Element, Parameterizable, QualifiedNameable {
darcy@411: /**
darcy@1181: * Returns the fields, methods, constructors, and member types
darcy@1181: * that are directly declared in this class or interface.
darcy@1181: *
darcy@1181: * This includes any (implicit) default constructor and
darcy@1181: * the implicit {@code values} and {@code valueOf} methods of an
darcy@1181: * enum type.
darcy@411: *
darcy@411: * Note that as a particular instance of the {@linkplain
darcy@411: * javax.lang.model.element general accuracy requirements} and the
darcy@411: * ordering behavior required of this interface, the list of
darcy@411: * enclosed elements will be returned in the natural order for the
darcy@411: * originating source of information about the type. For example,
darcy@411: * if the information about the type is originating from a source
darcy@411: * file, the elements will be returned in source code order.
darcy@411: * (However, in that case the the ordering of synthesized
darcy@411: * elements, such as a default constructor, is not specified.)
darcy@411: *
darcy@411: * @return the enclosed elements in proper order, or an empty list if none
darcy@411: */
darcy@1181: @Override
darcy@411: List extends Element> getEnclosedElements();
duke@1:
duke@1: /**
duke@1: * Returns the nesting kind of this type element.
duke@1: *
duke@1: * @return the nesting kind of this type element
duke@1: */
duke@1: NestingKind getNestingKind();
duke@1:
duke@1: /**
duke@1: * Returns the fully qualified name of this type element.
duke@1: * More precisely, it returns the canonical name.
duke@1: * For local and anonymous classes, which do not have canonical names,
duke@1: * an empty name is returned.
duke@1: *
duke@1: * The name of a generic type does not include any reference
duke@1: * to its formal type parameters.
duke@1: * For example, the fully qualified name of the interface
duke@1: * {@code java.util.Set