0N/A/*
553N/A * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
553N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
553N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
553N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
553N/A * or visit www.oracle.com if you need additional information or have any
553N/A * questions.
0N/A */
0N/A
0N/Apackage javax.lang.model.element;
0N/A
0N/A/**
0N/A * The <i>nesting kind</i> of a type element.
0N/A * Type elements come in four varieties:
0N/A * top-level, member, local, and anonymous.
0N/A * <i>Nesting kind</i> is a non-standard term used here to denote this
0N/A * classification.
0N/A *
0N/A * <p>Note that it is possible additional nesting kinds will be added
0N/A * in future versions of the platform.
0N/A *
0N/A * <p><b>Example:</b> The classes below are annotated with their nesting kind.
0N/A * <blockquote><pre>
0N/A *
0N/A * import java.lang.annotation.*;
0N/A * import static java.lang.annotation.RetentionPolicy.*;
0N/A * import javax.lang.model.element.*;
0N/A * import static javax.lang.model.element.NestingKind.*;
0N/A *
0N/A * &#64;Nesting(TOP_LEVEL)
0N/A * public class NestingExamples {
0N/A * &#64;Nesting(MEMBER)
0N/A * static class MemberClass1{}
0N/A *
0N/A * &#64;Nesting(MEMBER)
0N/A * class MemberClass2{}
0N/A *
0N/A * public static void main(String... argv) {
0N/A * &#64;Nesting(LOCAL)
0N/A * class LocalClass{};
0N/A *
0N/A * Class&lt;?&gt;[] classes = {
0N/A * NestingExamples.class,
0N/A * MemberClass1.class,
0N/A * MemberClass2.class,
0N/A * LocalClass.class
0N/A * };
0N/A *
0N/A * for(Class&lt;?&gt; clazz : classes) {
0N/A * System.out.format("%s is %s%n",
0N/A * clazz.getName(),
0N/A * clazz.getAnnotation(Nesting.class).value());
0N/A * }
0N/A * }
0N/A * }
0N/A *
0N/A * &#64;Retention(RUNTIME)
0N/A * &#64;interface Nesting {
0N/A * NestingKind value();
0N/A * }
0N/A * </pre></blockquote>
0N/A *
0N/A * @author Joseph D. Darcy
0N/A * @author Scott Seligman
0N/A * @author Peter von der Ah&eacute;
0N/A * @since 1.6
0N/A */
0N/Apublic enum NestingKind {
0N/A TOP_LEVEL,
0N/A MEMBER,
0N/A LOCAL,
0N/A ANONYMOUS;
0N/A
0N/A /**
0N/A * Does this constant correspond to a nested type element?
0N/A * A <i>nested</i> type element is any that is not top-level.
0N/A * An <i>inner</i> type element is any nested type element that
0N/A * is not {@linkplain Modifier#STATIC static}.
0N/A */
0N/A public boolean isNested() {
0N/A return this != TOP_LEVEL;
0N/A }
0N/A}