< prev index next >

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

Print this page




 106      *
 107      * If this element represents an unnamed {@linkplain
 108      * PackageElement#getSimpleName package} or unnamed {@linkplain
 109      * ModuleElement#getSimpleName module}, an empty name is returned.
 110      *
 111      * If it represents a {@linkplain ExecutableElement#getSimpleName
 112      * constructor}, the name "{@code <init>}" is returned.  If it
 113      * represents a {@linkplain ExecutableElement#getSimpleName static
 114      * initializer}, the name "{@code <clinit>}" is returned.
 115      *
 116      * If it represents an {@linkplain TypeElement#getSimpleName
 117      * anonymous class} or {@linkplain ExecutableElement#getSimpleName
 118      * instance initializer}, an empty name is returned.
 119      *
 120      * @return the simple name of this element
 121      * @see PackageElement#getSimpleName
 122      * @see ExecutableElement#getSimpleName
 123      * @see TypeElement#getSimpleName
 124      * @see VariableElement#getSimpleName
 125      * @see ModuleElement#getSimpleName


 126      */
 127     Name getSimpleName();
 128 
 129     /**
 130      * Returns the innermost element
 131      * within which this element is, loosely speaking, enclosed.
 132      * <ul>
 133      * <li> If this element is one whose declaration is lexically enclosed
 134      * immediately within the declaration of another element, that other
 135      * element is returned.
 136      *
 137      * <li> If this is a {@linkplain TypeElement#getEnclosingElement
 138      * top-level type}, its package is returned.
 139      *
 140      * <li> If this is a {@linkplain
 141      * PackageElement#getEnclosingElement package}, its module is
 142      * returned.
 143      *
 144      * <li> If this is a {@linkplain
 145      * TypeParameterElement#getEnclosingElement type parameter},
 146      * {@linkplain TypeParameterElement#getGenericElement the
 147      * generic element} of the type parameter is returned.
 148      *
 149      * <li> If this is a {@linkplain
 150      * VariableElement#getEnclosingElement method or constructor
 151      * parameter}, {@linkplain ExecutableElement the executable
 152      * element} which declares the parameter is returned.
 153      *
 154      * <li> If this is a {@linkplain ModuleElement#getEnclosingElement
 155      * module}, {@code null} is returned.
 156      *
 157      * </ul>
 158      *
 159      * @return the enclosing element, or {@code null} if there is none
 160      * @see Elements#getPackageOf


 161      */
 162     Element getEnclosingElement();
 163 
 164     /**
 165      * Returns the elements that are, loosely speaking, directly
 166      * enclosed by this element.
 167      *
 168      * A {@linkplain TypeElement#getEnclosedElements class or
 169      * interface} is considered to enclose the fields, methods,
 170      * constructors, and member types that it directly declares.
 171      *
 172      * A {@linkplain PackageElement#getEnclosedElements package}
 173      * encloses the top-level classes and interfaces within it, but is
 174      * not considered to enclose subpackages.
 175      *
 176      * A {@linkplain ModuleElement#getEnclosedElements module}
 177      * encloses packages within it.
 178      *
 179      * Other kinds of elements are not currently considered to enclose
 180      * any elements; however, that may change as this API or the
 181      * programming language evolves.
 182      *
 183      * <p>Note that elements of certain kinds can be isolated using
 184      * methods in {@link ElementFilter}.
 185      *
 186      * @return the enclosed elements, or an empty list if none
 187      * @see TypeElement#getEnclosedElements
 188      * @see PackageElement#getEnclosedElements
 189      * @see ModuleElement#getEnclosedElements
 190      * @see Elements#getAllMembers
 191      * @jls 8.8.9 Default Constructor
 192      * @jls 8.9 Enums


 193      */
 194     List<? extends Element> getEnclosedElements();
 195 
 196     /**
 197      * Returns {@code true} if the argument represents the same
 198      * element as {@code this}, or {@code false} otherwise.
 199      *
 200      * <p>Note that the identity of an element involves implicit state
 201      * not directly accessible from the element's methods, including
 202      * state about the presence of unrelated types.  Element objects
 203      * created by different implementations of these interfaces should
 204      * <i>not</i> be expected to be equal even if &quot;the same&quot;
 205      * element is being modeled; this is analogous to the inequality
 206      * of {@code Class} objects for the same class file loaded through
 207      * different class loaders.
 208      *
 209      * @param obj  the object to be compared with this element
 210      * @return {@code true} if the specified object represents the same
 211      *          element as this
 212      */




 106      *
 107      * If this element represents an unnamed {@linkplain
 108      * PackageElement#getSimpleName package} or unnamed {@linkplain
 109      * ModuleElement#getSimpleName module}, an empty name is returned.
 110      *
 111      * If it represents a {@linkplain ExecutableElement#getSimpleName
 112      * constructor}, the name "{@code <init>}" is returned.  If it
 113      * represents a {@linkplain ExecutableElement#getSimpleName static
 114      * initializer}, the name "{@code <clinit>}" is returned.
 115      *
 116      * If it represents an {@linkplain TypeElement#getSimpleName
 117      * anonymous class} or {@linkplain ExecutableElement#getSimpleName
 118      * instance initializer}, an empty name is returned.
 119      *
 120      * @return the simple name of this element
 121      * @see PackageElement#getSimpleName
 122      * @see ExecutableElement#getSimpleName
 123      * @see TypeElement#getSimpleName
 124      * @see VariableElement#getSimpleName
 125      * @see ModuleElement#getSimpleName
 126      * @revised 9
 127      * @spec JPMS
 128      */
 129     Name getSimpleName();
 130 
 131     /**
 132      * Returns the innermost element
 133      * within which this element is, loosely speaking, enclosed.
 134      * <ul>
 135      * <li> If this element is one whose declaration is lexically enclosed
 136      * immediately within the declaration of another element, that other
 137      * element is returned.
 138      *
 139      * <li> If this is a {@linkplain TypeElement#getEnclosingElement
 140      * top-level type}, its package is returned.
 141      *
 142      * <li> If this is a {@linkplain
 143      * PackageElement#getEnclosingElement package}, its module is
 144      * returned.
 145      *
 146      * <li> If this is a {@linkplain
 147      * TypeParameterElement#getEnclosingElement type parameter},
 148      * {@linkplain TypeParameterElement#getGenericElement the
 149      * generic element} of the type parameter is returned.
 150      *
 151      * <li> If this is a {@linkplain
 152      * VariableElement#getEnclosingElement method or constructor
 153      * parameter}, {@linkplain ExecutableElement the executable
 154      * element} which declares the parameter 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, 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      * Other kinds of elements are not currently considered to enclose
 184      * any elements; however, that may change as this API or the
 185      * programming language evolves.
 186      *
 187      * <p>Note that elements of certain kinds can be isolated using
 188      * methods in {@link ElementFilter}.
 189      *
 190      * @return the enclosed elements, or an empty list if none
 191      * @see TypeElement#getEnclosedElements
 192      * @see PackageElement#getEnclosedElements
 193      * @see ModuleElement#getEnclosedElements
 194      * @see Elements#getAllMembers
 195      * @jls 8.8.9 Default Constructor
 196      * @jls 8.9 Enums
 197      * @revised 9
 198      * @spec JPMS
 199      */
 200     List<? extends Element> getEnclosedElements();
 201 
 202     /**
 203      * Returns {@code true} if the argument represents the same
 204      * element as {@code this}, or {@code false} otherwise.
 205      *
 206      * <p>Note that the identity of an element involves implicit state
 207      * not directly accessible from the element's methods, including
 208      * state about the presence of unrelated types.  Element objects
 209      * created by different implementations of these interfaces should
 210      * <i>not</i> be expected to be equal even if &quot;the same&quot;
 211      * element is being modeled; this is analogous to the inequality
 212      * of {@code Class} objects for the same class file loaded through
 213      * different class loaders.
 214      *
 215      * @param obj  the object to be compared with this element
 216      * @return {@code true} if the specified object represents the same
 217      *          element as this
 218      */


< prev index next >