Package org.graalvm.polyglot.tck
Class Snippet
java.lang.Object
org.graalvm.polyglot.tck.Snippet
The unit of execution with assigned parameters and result types. The
Snippet represents
an execution of value constructor, statement, expression and script. The Snippet provides
parameter(s) and return types used to compose the Snippets.- Since:
- 0.30
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionorg.graalvm.polyglot.ValueReturns the function executing theSnippet.getId()Returns the identifier of a snippet.List<? extends TypeDescriptor> Returns the types ofSnippetformal parameters.Returns theResultVerifierto verify the execution result.Returns theSnippetreturn type.static Snippet.BuildernewBuilder(String id, org.graalvm.polyglot.Value executableValue, TypeDescriptor executableReturnType) Creates a newSnippetbuilder object.toString()
-
Method Details
-
getId
Returns the identifier of a snippet. TheSnippets from a singleLanguageProviderwith the same identifier but different types are treated as overloads.- Returns:
- the
Snippetidentifier - Since:
- 0.30
-
getExecutableValue
public org.graalvm.polyglot.Value getExecutableValue()Returns the function executing theSnippet.- Returns:
- the executable
Value - Since:
- 0.30
-
getReturnType
Returns theSnippetreturn type.- Returns:
- the return type
- Since:
- 0.30
-
getParameterTypes
Returns the types ofSnippetformal parameters.- Returns:
- the parameter types
- Since:
- 0.30
-
getResultVerifier
Returns theResultVerifierto verify the execution result.- Returns:
- either a custom or the default
ResultVerifier. - Since:
- 0.30
-
toString
-
newBuilder
public static Snippet.Builder newBuilder(String id, org.graalvm.polyglot.Value executableValue, TypeDescriptor executableReturnType) Creates a newSnippetbuilder object.- Parameters:
id- theSnippetidentifier TheSnippets from a singleLanguageProviderwith the same identifier but different types are treated as overloads.executableValue- the executableValueused to execute theSnippetexecutableReturnType- theSnippetreturn type- Returns:
- the new
Snippet.Builder - Since:
- 0.30
-