Package org.jtool.srcmodel
Class JavaElement
java.lang.Object
org.jtool.srcmodel.JavaElement
- Direct Known Subclasses:
JavaClass
,JavaMethod
,JavaVariable
A root object for a Java model element.
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
JavaElement
(org.eclipse.jdt.core.dom.ASTNode node) Creates a new object of this model element. -
Method Summary
Modifier and TypeMethodDescriptionorg.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
getFile()
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.
-
Field Details
-
astNode
protected final org.eclipse.jdt.core.dom.ASTNode astNodeAn AST node corresponding to this model element. -
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
Returns the fully qualified name of this model element.- Returns:
- the fully qualified name
-
getJavaProject
Returns the project which this model element exists in.- Returns:
- the project of this model element
-
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
Returns the range information on a code fragment of this model element.- Returns:
- the code range information on this model element
-
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
-