public interface

IJavaElement

com.pnfsoftware.jeb.core.units.code.java.IJavaElement
Known Indirect Subclasses

Class Overview

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:

Summary

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 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> getTagMap()
This method is deprecated. make sure to update your scripts as this method will be removed in a subsequent release
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.

Public Methods

public abstract Object addTag (String key, Object value)

Add a tag.

public abstract void collectAllPhysicalOffsets (Collection<Integer> physicalOffsets)

Collect physical offsets for this element and all its constituents. The first element added is for 'this' one, then getSubElements()'s.

Parameters
physicalOffsets output collection

public abstract JavaElementType getElementType ()

This convenience method returns the type of Java AST element held by this object.

public abstract int getPhysicalOffset ()

Return the lowest-level offset that map to this AST element.

Returns
  • a physical method offset, -1 if none is available

public abstract List<? extends IJavaElement> getSubElements ()

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.

Returns
  • the list of constituting elements, may be empty but never null

public abstract Map<String, Object> getTagMap ()

This method is deprecated.
make sure to update your scripts as this method will be removed in a subsequent release

Retrieve the tags associated to this element. Clients may add, get, and remove tags directly from the returned map.

Returns
  • a dictionary of string to object entries

public abstract Map<String, Object> getTags ()

Get a read-only collection of the current tag map.

public abstract boolean hasPhysicalOffset ()

public abstract Object removeTag (String key)

Remove a tag.

public abstract boolean replaceSubElement (IJavaElement oldElement, IJavaElement newElement)

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.

Parameters
oldElement the element to be replaced
newElement the new element