1 /*
2 * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
60 * @see TypeMirror
61 * @since 1.6
62 */
63 public interface Element extends javax.lang.model.AnnotatedConstruct {
64 /**
65 * Returns the type defined by this element.
66 * @return the type defined by this element
67 *
68 * @see Types
69 * @see ExecutableElement#asType
70 * @see ModuleElement#asType
71 * @see PackageElement#asType
72 * @see TypeElement#asType
73 * @see TypeParameterElement#asType
74 * @see VariableElement#asType
75 */
76 TypeMirror asType();
77
78 /**
79 * Returns the {@code kind} of this element.
80 *
81 * @return the kind of this element
82 */
83 ElementKind getKind();
84
85 /**
86 * Returns the modifiers of this element, excluding annotations.
87 * Implicit modifiers, such as the {@code public} and {@code static}
88 * modifiers of interface members, are included.
89 *
90 * @return the modifiers of this element, or an empty set if there are none
91 */
92 Set<Modifier> getModifiers();
93
94 /**
95 * Returns the simple (unqualified) name of this element. The
96 * name of a generic type does not include any reference to its
97 * formal type parameters.
98 *
99 * For example, the simple name of the type element {@code
|
1 /*
2 * Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
60 * @see TypeMirror
61 * @since 1.6
62 */
63 public interface Element extends javax.lang.model.AnnotatedConstruct {
64 /**
65 * Returns the type defined by this element.
66 * @return the type defined by this element
67 *
68 * @see Types
69 * @see ExecutableElement#asType
70 * @see ModuleElement#asType
71 * @see PackageElement#asType
72 * @see TypeElement#asType
73 * @see TypeParameterElement#asType
74 * @see VariableElement#asType
75 */
76 TypeMirror asType();
77
78 /**
79 * Returns the {@code kind} of this element.
80 *
81 * <ul>
82 *
83 * <li> The kind of a {@linkplain PackageElement package} is
84 * {@link ElementKind#PACKAGE PACKAGE}.
85 *
86 * <li> The kind of a {@linkplain ModuleElement module} is {@link
87 * ElementKind#MODULE MODULE}.
88 *
89 * <li> The kind of a {@linkplain TypeElement type element} is one
90 * of {@link ElementKind#ANNOTATION_TYPE ANNOTATION_TYPE}, {@link
91 * ElementKind#CLASS CLASS}, {@link ElementKind#ENUM ENUM}, {@link
92 * ElementKind#INTERFACE INTERFACE}, or {@link ElementKind#RECORD
93 * RECORD}.
94 *
95 * <li> The kind of a {@linkplain VariableElement variable} is one
96 * of {@link ElementKind#ENUM_CONSTANT ENUM_CONSTANT}, {@link
97 * ElementKind#EXCEPTION_PARAMETER EXCEPTION_PARAMETER}, {@link
98 * ElementKind#FIELD FIELD}, {@link ElementKind#LOCAL_VARIABLE
99 * LOCAL_VARIABLE}, {@link ElementKind#PARAMETER PARAMETER},
100 * {@link ElementKind#RESOURCE_VARIABLE RESOURCE_VARIABLE}, or
101 * {@link ElementKind#BINDING_VARIABLE BINDING_VARIABLE}.
102 *
103 * <li> The kind of an {@linkplain ExecutableElement executable}
104 * is one of {@link ElementKind#CONSTRUCTOR CONSTRUCTOR}, {@link
105 * ElementKind#INSTANCE_INIT INSTANCE_INIT}, {@link
106 * ElementKind#METHOD METHOD}, or {@link ElementKind#STATIC_INIT
107 * STATIC_INIT}.
108 *
109 * <li> The kind of a {@linkplain TypeParameterElement type parameter} is
110 * {@link ElementKind#TYPE_PARAMETER TYPE_PARAMETER}.
111 *
112 * <li> The kind of a {@linkplain RecordComponentElement record
113 * component} is {@link ElementKind#RECORD_COMPONENT
114 * RECORD_COMPONENT}.
115 *
116 * </ul>
117 *
118 * @return the kind of this element
119 */
120 ElementKind getKind();
121
122 /**
123 * Returns the modifiers of this element, excluding annotations.
124 * Implicit modifiers, such as the {@code public} and {@code static}
125 * modifiers of interface members, are included.
126 *
127 * @return the modifiers of this element, or an empty set if there are none
128 */
129 Set<Modifier> getModifiers();
130
131 /**
132 * Returns the simple (unqualified) name of this element. The
133 * name of a generic type does not include any reference to its
134 * formal type parameters.
135 *
136 * For example, the simple name of the type element {@code
|