public class PolyglotRuntime.Instrument extends Object
All methods here, as well as instrumentation services in general, can be used safely from threads other than the engine's single execution thread.
Refer to TruffleInstrument for information about implementing and installing
instruments.
PolyglotRuntime.getInstruments()| Modifier and Type | Method and Description |
|---|---|
String |
getId()
Gets the id clients can use to acquire this instrument.
|
String |
getName()
Gets a human readable name of this instrument.
|
String |
getVersion()
Gets the version of this instrument.
|
boolean |
isEnabled()
Returns whether this instrument is currently enabled in the engine.
|
<T> T |
lookup(Class<T> type)
Returns an additional service provided by this instrument, specified by type.
|
void |
setEnabled(boolean enabled)
Enables/disables this instrument in the engine.
|
String |
toString() |
public String getId()
public String getName()
public String getVersion()
public boolean isEnabled()
public <T> T lookup(Class<T> type)
Here is an example for locating a hypothetical DebuggerController:
PolyglotRuntimeruntime = engine.getRuntime();PolyglotRuntime.Instrumentinstrument = runtime.getInstruments().get(DebuggerExample.ID); assert !instrument.isEnabled() : "Not enabled yet"; debugger = instrument.lookup(DebuggerController.class); assert instrument.isEnabled() : "Got enabled"; assert debugger != null : "We can control the debugger";
T - the type of the servicetype - class of the service that is being requestednull if no such service is availablepublic void setEnabled(boolean enabled)
enabled - true to enable false to disable