Class JavaElement

java.lang.Object
org.jtool.srcmodel.JavaElement
Direct Known Subclasses:
JavaClass, JavaMethod, JavaVariable

public abstract class JavaElement extends Object
A root object for a Java model element.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final org.eclipse.jdt.core.dom.ASTNode
    An AST node corresponding to this model element.
    protected final CodeRange
    Information on a code fragment for this model element.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    JavaElement(org.eclipse.jdt.core.dom.ASTNode node)
    Creates a new object of this model element.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.eclipse.jdt.core.dom.ASTNode
    Returns the AST node corresponding to this model element.
    Returns the range information on a code fragment of this model element.
    abstract JavaFile
    Returns the file that declares this model element.
    abstract JavaProject
    Returns the project which this model element exists in.
    abstract QualifiedName
    Returns the fully qualified name of this model element.
    Obtains the source code corresponding to a code fragment of this model element.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • astNode

      protected final org.eclipse.jdt.core.dom.ASTNode astNode
      An AST node corresponding to this model element.
    • codeRange

      protected final CodeRange codeRange
      Information on a code fragment for this model element.
  • Constructor Details

    • JavaElement

      protected JavaElement(org.eclipse.jdt.core.dom.ASTNode node)
      Creates a new object of this model element. This constructor is intended to be invoked by subclasses when creation their objects.
      Parameters:
      node - an AST node corresponding to this model element
  • Method Details

    • getQualifiedName

      public abstract QualifiedName getQualifiedName()
      Returns the fully qualified name of this model element.
      Returns:
      the fully qualified name
    • getJavaProject

      public abstract JavaProject getJavaProject()
      Returns the project which this model element exists in.
      Returns:
      the project of this model element
    • getFile

      public abstract JavaFile getFile()
      Returns the file that declares this model element.
      Returns:
      the declaring file
    • getASTNode

      public org.eclipse.jdt.core.dom.ASTNode getASTNode()
      Returns the AST node corresponding to this model element.
      Returns:
      the corresponding AST node
    • getCodeRange

      public CodeRange getCodeRange()
      Returns the range information on a code fragment of this model element.
      Returns:
      the code range information on this model element
    • getSource

      public String getSource()
      Obtains the source code corresponding to a code fragment of this model element.
      Returns:
      the source code of this model element, or the empty string if there is no source code