47 * 48 * <p> To implement operations based on the class of an {@code 49 * Element} object, either use a {@linkplain ElementVisitor visitor} or 50 * use the result of the {@link #getKind} method. Using {@code 51 * instanceof} is <em>not</em> necessarily a reliable idiom for 52 * determining the effective class of an object in this modeling 53 * hierarchy since an implementation may choose to have a single object 54 * implement multiple {@code Element} subinterfaces. 55 * 56 * @author Joseph D. Darcy 57 * @author Scott Seligman 58 * @author Peter von der Ahé 59 * @see Elements 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 * 67 * <p> A generic element defines a family of types, not just one. 68 * If this is a generic element, a <i>prototypical</i> type is 69 * returned. This is the element's invocation on the 70 * type variables corresponding to its own formal type parameters. 71 * For example, 72 * for the generic class element {@code C<N extends Number>}, 73 * the parameterized type {@code C<N>} is returned. 74 * The {@link Types} utility interface has more general methods 75 * for obtaining the full range of types defined by an element. 76 * 77 * @see Types 78 * 79 * @return the type defined by this element 80 */ 81 TypeMirror asType(); 82 83 /** 84 * Returns the {@code kind} of this element. 85 * 86 * @return the kind of this element 87 */ 88 ElementKind getKind(); 89 90 /** 91 * Returns the modifiers of this element, excluding annotations. 92 * Implicit modifiers, such as the {@code public} and {@code static} 93 * modifiers of interface members, are included. 94 * 95 * @return the modifiers of this element, or an empty set if there are none 96 */ 97 Set<Modifier> getModifiers(); | 47 * 48 * <p> To implement operations based on the class of an {@code 49 * Element} object, either use a {@linkplain ElementVisitor visitor} or 50 * use the result of the {@link #getKind} method. Using {@code 51 * instanceof} is <em>not</em> necessarily a reliable idiom for 52 * determining the effective class of an object in this modeling 53 * hierarchy since an implementation may choose to have a single object 54 * implement multiple {@code Element} subinterfaces. 55 * 56 * @author Joseph D. Darcy 57 * @author Scott Seligman 58 * @author Peter von der Ahé 59 * @see Elements 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 * 67 * @see Types 68 * @see ExecutableElement#asType 69 * @see ModuleElement#asType 70 * @see PackageElement#asType 71 * @see TypeElement#asType 72 * @see TypeParameterElement#asType 73 * @see VariableElement#asType 74 * 75 * @return the type defined by this element 76 */ 77 TypeMirror asType(); 78 79 /** 80 * Returns the {@code kind} of this element. 81 * 82 * @return the kind of this element 83 */ 84 ElementKind getKind(); 85 86 /** 87 * Returns the modifiers of this element, excluding annotations. 88 * Implicit modifiers, such as the {@code public} and {@code static} 89 * modifiers of interface members, are included. 90 * 91 * @return the modifiers of this element, or an empty set if there are none 92 */ 93 Set<Modifier> getModifiers(); |