public final class InlineSnippet extends Object
InlineSnippet
represents an execution of
a script and an associated inline source code that is to be executed at script's locations.
It's recommended to provide two snippets at least, one with local variables and restricted
location predicate
and one with globally accessible
code
and no location predicate.
Modifier and Type | Class and Description |
---|---|
static class |
InlineSnippet.Builder
The builder of an
InlineSnippet . |
Modifier and Type | Method and Description |
---|---|
CharSequence |
getCode()
Returns an inline source code that is to be executed at specific
locations , or at all statement and call locations if the
predicate is null . |
Predicate<SourceSection> |
getLocationPredicate()
Returns a testing predicate for locations at which
source code is
executed. |
ResultVerifier |
getResultVerifier()
Returns the
ResultVerifier to verify the result of source code
execution. |
Snippet |
getScript()
Returns a script to be executed.
|
static InlineSnippet.Builder |
newBuilder(Snippet script,
CharSequence code)
Creates a new
InlineSnippet builder object. |
String |
toString() |
public Snippet getScript()
source code
is executed inlined in
this script.public CharSequence getCode()
locations
, or at all statement and call locations if the
predicate is null
.public Predicate<SourceSection> getLocationPredicate()
source code
is
executed.true
for SourceSection
s where the
source code
is to be executed, or null
if the source
code should be executed at all instrumentable statement and call locations.public ResultVerifier getResultVerifier()
ResultVerifier
to verify the result of source code
execution.ResultVerifier
.ResultVerifier.accept(org.graalvm.polyglot.tck.ResultVerifier.SnippetRun).
public static InlineSnippet.Builder newBuilder(Snippet script, CharSequence code)
InlineSnippet
builder object.script
- the script to execute (use
Snippet.newBuilder(String, Value, TypeDescriptor)
to create one)code
- the inline source code that is to be executed inside the scriptInlineSnippet.Builder