com.pnfsoftware.jeb.core.units.code.java.IJavaElement |
![]() |
Base interface for all elements of a Java Abstract Syntax Tree.
Each AST element implements this interface or one of the sub-interfaces, such as:
INonStatement
interface. Examples: method
,
constant
, static field
, etc.IStatement
interface. Examples: Assignment assignment, Continue
continue, WhileStm while, etc.Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
abstract Object |
addTag(String key, Object value)
Add a tag.
| ||||||||||
abstract void |
collectAllPhysicalOffsets(Collection<Integer> physicalOffsets)
Collect physical offsets for this element and all its constituents.
| ||||||||||
abstract Object |
getData(Object key)
Retrieve a piece of data attached to this AST element.
| ||||||||||
abstract JavaElementType |
getElementType()
This convenience method returns the type of Java AST element held by this object.
| ||||||||||
abstract int |
getPhysicalOffset()
Return the lowest-level offset that map to this AST element.
| ||||||||||
abstract List<? extends IJavaElement> |
getSubElements()
Get the list of AST elements that constitute this AST element.
| ||||||||||
abstract Map<String, Object> |
getTags()
Get a read-only collection of the current tag map.
| ||||||||||
abstract boolean | hasPhysicalOffset() | ||||||||||
abstract Object |
removeTag(String key)
Remove a tag.
| ||||||||||
abstract boolean |
replaceSubElement(IJavaElement oldElement, IJavaElement newElement)
Replace one element by another one.
| ||||||||||
abstract void |
setData(String key, Object value)
Attach a piece of data to this AST element.
| ||||||||||
abstract String | toShortString() |
Add a tag.
Collect physical offsets for this element and all its constituents. The first element
added
is for 'this' one, then getSubElements()
's.
physicalOffsets | output collection |
---|
Retrieve a piece of data attached to this AST element.
This convenience method returns the type of Java AST element held by this object.
Return the lowest-level offset that map to this AST element.
Get the list of AST elements that constitute this AST element. Typically, for simple statements, it may be expression. For complex expressions, it may be simpler expressions. For compound statements, it may more statements and expressions.
Note that type
and annotation
elements are not
returned by this method.
Get a read-only collection of the current tag map.
Remove a tag.
Replace one element by another one. Only the references are compared, no equals/deep compare. At most one element is replaced.
Note that type
and annotation
elements cannot be
replaced using this method.
oldElement | the element to be replaced |
---|---|
newElement | the new element |
Attach a piece of data to this AST element.