Class ExecutionEvent

java.lang.Object
org.graalvm.polyglot.management.ExecutionEvent

public final class ExecutionEvent extends Object
An execution event object passed to an execution listener consumer. Execution event instances remain valid until the engine is closed. Values and returned exceptions will only remain valid until the context was closed.
Since:
19.0
See Also:
  • Method Details

    • getLocation

      public SourceSection getLocation()
      Returns the source location of the event that was triggered or null if no location source location is available.
      Since:
      19.0
    • getRootName

      public String getRootName()
      Returns the root name or null if no name is available. The root name may also be available for events caused by expressions and statements. In this case the name of the containing root will be returned.
      Since:
      19.0
    • getInputValues

      public List<Value> getInputValues()
      Returns the input values provided to execute this source location. This method returns null if input value collection is not enabled. Input values are available in OnReturn events.The returned list may contain null values if input values were not evaluated or if an exception occurred executing input values. The returned list is unmodifiable. The returned input values may escape the event consumer and remain valid until the context is closed.
      Since:
      19.0
    • getReturnValue

      public Value getReturnValue()
      Returns the return value of this source location after it was executed. This method returns null if return value collection is not enabled. Return values are available in OnReturn events. The returned value is allowed to escape the event consumer and remain valid until the context is closed.
      Since:
      19.0
    • getException

      public PolyglotException getException()
      Returns the exception of this source location after it was executed. This method returns null if exception collection is not enabled. Exceptions are only available in OnReturn events if an exception was thrown when the location was executed. The returned value is allowed to escape the event consumer and remains valid until the context is closed.
      Since:
      19.0
    • isExpression

      public boolean isExpression()
      Returns true if the source location is marked as expression, else false. The collection of expression events may be enabled by calling ExecutionListener.Builder.expressions(boolean).
      Since:
      19.0
    • isStatement

      public boolean isStatement()
      Returns true if the source location is marked as a statement, else false. The collection of statement events may be enabled by calling ExecutionListener.Builder.statements(boolean).
      Since:
      19.0
    • isRoot

      public boolean isRoot()
      Returns true if the source location is marked as a root of a function, method or closure, else false. The collection of root events may be enabled by calling ExecutionListener.Builder.roots(boolean).
      Since:
      19.0
    • toString

      public String toString()
      Overrides:
      toString in class Object
      Since:
      19.0