< prev index next >

src/java.compiler/share/classes/javax/lang/model/element/Element.java

Print this page




 131      * immediately within the declaration of another element, that other
 132      * element is returned.
 133      *
 134      * <li> If this is a {@linkplain TypeElement#getEnclosingElement
 135      * top-level type}, its package is returned.
 136      *
 137      * <li> If this is a {@linkplain
 138      * PackageElement#getEnclosingElement package}, its module is
 139      * returned if such a module exists. Otherwise, {@code null} is returned.
 140      *
 141      * <li> If this is a {@linkplain
 142      * TypeParameterElement#getEnclosingElement type parameter},
 143      * {@linkplain TypeParameterElement#getGenericElement the
 144      * generic element} of the type parameter is returned.
 145      *
 146      * <li> If this is a {@linkplain
 147      * VariableElement#getEnclosingElement method or constructor
 148      * parameter}, {@linkplain ExecutableElement the executable
 149      * element} which declares the parameter is returned.
 150      *





 151      * <li> If this is a {@linkplain ModuleElement#getEnclosingElement
 152      * module}, {@code null} is returned.
 153      *
 154      * </ul>
 155      *
 156      * @return the enclosing element, or {@code null} if there is none
 157      * @see Elements#getPackageOf
 158      * @revised 9
 159      * @spec JPMS
 160      */
 161     Element getEnclosingElement();
 162 
 163     /**
 164      * Returns the elements that are, loosely speaking, directly
 165      * enclosed by this element.
 166      *
 167      * A {@linkplain TypeElement#getEnclosedElements class or
 168      * interface} is considered to enclose the fields, methods,
 169      * constructors, and member types that it directly declares.
 170      *
 171      * A {@linkplain PackageElement#getEnclosedElements package}
 172      * encloses the top-level classes and interfaces within it, but is
 173      * not considered to enclose subpackages.
 174      *
 175      * A {@linkplain ModuleElement#getEnclosedElements module}
 176      * encloses packages within it.
 177      *
 178      * Enclosed elements may include implicitly declared {@linkplain
 179      * Elements.Origin#MANDATED mandated} elements.
 180      *
 181      * Other kinds of elements are not currently considered to enclose
 182      * any elements; however, that may change as this API or the
 183      * programming language evolves.
 184      *
 185      * @apiNote Elements of certain kinds can be isolated using
 186      * methods in {@link ElementFilter}.
 187      *
 188      * @return the enclosed elements, or an empty list if none
 189      * @see TypeElement#getEnclosedElements




 131      * immediately within the declaration of another element, that other
 132      * element is returned.
 133      *
 134      * <li> If this is a {@linkplain TypeElement#getEnclosingElement
 135      * top-level type}, its package is returned.
 136      *
 137      * <li> If this is a {@linkplain
 138      * PackageElement#getEnclosingElement package}, its module is
 139      * returned if such a module exists. Otherwise, {@code null} is returned.
 140      *
 141      * <li> If this is a {@linkplain
 142      * TypeParameterElement#getEnclosingElement type parameter},
 143      * {@linkplain TypeParameterElement#getGenericElement the
 144      * generic element} of the type parameter is returned.
 145      *
 146      * <li> If this is a {@linkplain
 147      * VariableElement#getEnclosingElement method or constructor
 148      * parameter}, {@linkplain ExecutableElement the executable
 149      * element} which declares the parameter is returned.
 150      *
 151      * <li> If this is a {@linkplain
 152      * VariableElement#getEnclosingElement state component},
 153      * {@linkplain ExecutableElement the type} which declares the
 154      * state component is returned.
 155      *
 156      * <li> If this is a {@linkplain ModuleElement#getEnclosingElement
 157      * module}, {@code null} is returned.
 158      *
 159      * </ul>
 160      *
 161      * @return the enclosing element, or {@code null} if there is none
 162      * @see Elements#getPackageOf
 163      * @revised 9
 164      * @spec JPMS
 165      */
 166     Element getEnclosingElement();
 167 
 168     /**
 169      * Returns the elements that are, loosely speaking, directly
 170      * enclosed by this element.
 171      *
 172      * A {@linkplain TypeElement#getEnclosedElements class or
 173      * interface} is considered to enclose the fields, methods,
 174      * constructors, state components, and member types that it directly declares.
 175      *
 176      * A {@linkplain PackageElement#getEnclosedElements package}
 177      * encloses the top-level classes and interfaces within it, but is
 178      * not considered to enclose subpackages.
 179      *
 180      * A {@linkplain ModuleElement#getEnclosedElements module}
 181      * encloses packages within it.
 182      *
 183      * Enclosed elements may include implicitly declared {@linkplain
 184      * Elements.Origin#MANDATED mandated} elements.
 185      *
 186      * Other kinds of elements are not currently considered to enclose
 187      * any elements; however, that may change as this API or the
 188      * programming language evolves.
 189      *
 190      * @apiNote Elements of certain kinds can be isolated using
 191      * methods in {@link ElementFilter}.
 192      *
 193      * @return the enclosed elements, or an empty list if none
 194      * @see TypeElement#getEnclosedElements


< prev index next >