Package org.eclipse.handly.model

# Interface ISourceElementExtension

All Superinterfaces:
  `IElement`, `ISourceElement`

public interface ISourceElementExtension extends ISourceElement
Model implementors may opt to extend this interface, which extends `ISourceElement` with a number of default methods.

This interface is not intended to be referenced for purposes other than extension.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `default ISourceElement`
  `getSourceElementAt(int position, ISnapshot base)`
  Returns the smallest element within this element that includes the given source position, or `null` if the given position is not within the source range of this element.
  `default ISourceElementInfo`
  `getSourceElementInfo()`
  Returns an object holding cached structure and properties for this element.

  ### Methods inherited from interface org.eclipse.handly.model.IElement

  `equals, hashCode`

- ## Method Details

  - ### getSourceElementAt

    default ISourceElement getSourceElementAt(int position, ISnapshot base) throws org.eclipse.core.runtime.CoreException
    Returns the smallest element within this element that includes the given source position, or `null` if the given position is not within the source range of this element. If no finer grained element is found at the position, this element itself is returned.
    Parameters:
      `position` - a source position (0-based)
      `base` - a snapshot on which the given position is based, or `null` if the snapshot is unknown or does not matter
    Returns:
      the innermost element enclosing the given source position, or `null` if none (including this element itself)
    Throws:
      `org.eclipse.core.runtime.CoreException` - if this element does not exist or if an exception occurs while accessing its corresponding resource
      `StaleSnapshotException` - if snapshot inconsistency is detected, i.e., this element's current structure and properties are based on a different snapshot

  - ### getSourceElementInfo

    default ISourceElementInfo getSourceElementInfo() throws org.eclipse.core.runtime.CoreException
    Returns an object holding cached structure and properties for this element.
    Returns:
      an `ISourceElementInfo` for this element (never `null`)
    Throws:
      `org.eclipse.core.runtime.CoreException` - if this element does not exist or if an exception occurs while accessing its corresponding resource