< prev index next >

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

Print this page




  46  * always be represented by the same object.
  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&eacute;
  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      * @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     /**




  46  * always be represented by the same object.
  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&eacute;
  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();
  98 
  99     /**


< prev index next >