Interface JavaModelElement

All Superinterfaces:
Comparable<JavaElement>, org.revapi.Element<JavaElement>, JavaElement
All Known Subinterfaces:
JavaFieldElement, JavaMethodElement, JavaMethodParameterElement, JavaTypeElement

public interface JavaModelElement extends JavaElement
All elements corresponding to various Java language model (apart from annotations (see JavaAnnotationElement)), i.e. classes, methods, fields and method parameters, will implement this interface.
Since:
0.1
Author:
Lukas Krejci
  • Method Summary

    Modifier and Type
    Method
    Description
    For an inherited method for example, this will return the element in the super type that declares this method.
    Note that this is distinctly different from getDeclaringElement().
     
     
    boolean
    Each JavaTypeElement contains as its children not only the elements that are declared on the type but also elements that it inherits from its super types (with type parameters "instantiated" according to the actual type).

    Methods inherited from interface java.lang.Comparable

    compareTo

    Methods inherited from interface org.revapi.Element

    as, getApi, getArchive, getChildren, getCumulativeReferencedElements, getCumulativeReferencingElements, getFullHumanReadableString, getReferencedElements, getReferencingElements, iterateOverChildren, searchChildren, searchChildren, setParent, stream

    Methods inherited from interface org.revapi.java.spi.JavaElement

    getTypeEnvironment
  • Method Details

    • getParent

      Specified by:
      getParent in interface org.revapi.Element<JavaElement>
    • getModelRepresentation

      TypeMirror getModelRepresentation()
      Note that this is distinctly different from getDeclaringElement(). This method returns a type mirror describing an element on its position in the type hierarchy. I.e. if an inherited method with type parameters resolved according to the class it is inherited "to".
      Returns:
      the representation of this java element at its position in the type hierarchy
    • getDeclaringElement

      Element getDeclaringElement()
      For an inherited method for example, this will return the element in the super type that declares this method.
      Returns:
      The element that represents the declaration this model element.
    • isInherited

      boolean isInherited()
      Each JavaTypeElement contains as its children not only the elements that are declared on the type but also elements that it inherits from its super types (with type parameters "instantiated" according to the actual type).

      This flag indicates if this is a child of type that is directly declared on it (false) or if it is an instantiation of an inherited element (true).

      Returns:
      false if the parent type declares this child element, true if it is inherited from a super type
    • getParentType

      @Nullable default JavaTypeElement getParentType()
      Returns:
      the closest parent that is a java type element.