public abstract class Instrumenter extends Object
ExecutionEventNodeFactory and
ExecutionEventListener instances for a set of source locations specified by a
SourceSectionFilter. The result of an attachment is a binding.| Modifier and Type | Method and Description |
|---|---|
abstract <T extends OutputStream> |
attachErrConsumer(T stream)
Attach an output stream as a consumer of the
error output
. |
abstract <T extends ExecutionEventNodeFactory> |
attachFactory(SourceSectionFilter filter,
T factory)
|
abstract <T extends ExecutionEventListener> |
attachListener(SourceSectionFilter filter,
T listener)
|
abstract <T extends LoadSourceListener> |
attachLoadSourceListener(SourceSectionFilter filter,
T listener,
boolean includeExistingSources)
|
abstract <T extends LoadSourceSectionListener> |
attachLoadSourceSectionListener(SourceSectionFilter filter,
T listener,
boolean includeExistingSourceSections)
Starts notifications for each
SourceSection in every newly loaded Source and
returns a binding that can be used to terminate notifications. |
abstract <T extends OutputStream> |
attachOutConsumer(T stream)
Attach an output stream as a consumer of the
standard
output. |
List<SourceSection> |
querySourceSections(SourceSectionFilter filter)
Returns a filtered list of loaded
SourceSection instances. |
abstract Set<Class<?>> |
queryTags(Node node)
Returns an unmodifiable
Set of tag classes which where associated with this node. |
public abstract <T extends ExecutionEventNodeFactory> EventBinding<T> attachFactory(SourceSectionFilter filter, T factory)
factory and returns a
binding which represents a handle to dispose the notification.public abstract <T extends ExecutionEventListener> EventBinding<T> attachListener(SourceSectionFilter filter, T listener)
listener and returns a
binding which represents a handle to dispose the notification.public abstract <T extends LoadSourceListener> EventBinding<T> attachLoadSourceListener(SourceSectionFilter filter, T listener, boolean includeExistingSources)
Source and returns a
binding that can be used to terminate notifications. Only
subsequent loads will be notified unless includeExistingSources is true, in which
case a notification for each previous load will be delivered before this method returns.
Note: the provided SourceSectionFilter must only contain filters on
sources or
mime types.
filter - a filter on which sources trigger events. Only filters are allowed.listener - a listener that gets notified if a source was loadedincludeExistingSources - whether or not this listener should be notified for sources
which were already loaded at the time when this listener was attached.LoadSourceListener.onLoad(LoadSourceEvent)public abstract <T extends LoadSourceSectionListener> EventBinding<T> attachLoadSourceSectionListener(SourceSectionFilter filter, T listener, boolean includeExistingSourceSections)
SourceSection in every newly loaded Source and
returns a binding that can be used to terminate notifications. Only
subsequent loads will be notified unless includeExistingSourceSections is true, in
which case a notification for each previous load will be delivered before this method
returns.filter - a filter on which sources sections trigger eventslistener - a listener that gets notified if a source section was loadedincludeExistingSourceSections - whether or not this listener should be notified for
sources which were already loaded at the time when this listener was attached.LoadSourceSectionListener.onLoad(LoadSourceSectionEvent)public abstract <T extends OutputStream> EventBinding<T> attachOutConsumer(T stream)
standard
output. The consumer output stream receives all output that goes to
TruffleInstrument.Env.out() since this call, including output emitted by the
PolyglotEngine this instrumenter is being executed in,
output from instruments (including this one), etc. Be sure to dispose the binding when it's not used any more.public abstract <T extends OutputStream> EventBinding<T> attachErrConsumer(T stream)
error output
. The consumer output stream receives all error output that goes to
TruffleInstrument.Env.err() since this call, including error output emitted by the
PolyglotEngine this instrumenter is being executed in,
error output from instruments (including this one), etc. Be sure to
dispose the binding when it's not used any more.public final List<SourceSection> querySourceSections(SourceSectionFilter filter)
SourceSection instances.filter - criterion for inclusionpublic abstract Set<Class<?>> queryTags(Node node)
Set of tag classes which where associated with this node. If
the instrumenter is used as a TruffleLanguage then only nodes can be queried for tags
that are associated with the current language otherwise an IllegalArgumentException
is thrown. The given node must not be null. If the given node is not
instrumentable, the given node is not yet adopted by a RootNode or the given tag was
not provided by the language then always an empty Set is
returned.node - the node to querySet of tag classes which where associated with this node.