Elide GraalVM25.6.0-elide.4
All types
Versions and modules

Snippet

Javaclassin org.graalvm.polyglot.tcksince 0.30

public final class Snippet
Inheritance
  1. Object
  2. 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.

Methods7

String getId()

getId

since 0.30
public String getId()

Returns the identifier of a snippet. The Snippets from a single LanguageProvider with the same identifier but different types are treated as overloads.

Returns

String
the Snippet identifier
Value getExecutableValue()

getExecutableValue

since 0.30
public Value getExecutableValue()

Returns the function executing the Snippet.

Returns

Value
the executable Value
TypeDescriptor getReturnType()

getReturnType

since 0.30
public TypeDescriptor getReturnType()

Returns the Snippet return type.

Returns

TypeDescriptor
the return type
List<? extends TypeDescriptor> getParameterTypes()

getParameterTypes

since 0.30
public List<? extends TypeDescriptor> getParameterTypes()

Returns the types of Snippet formal parameters.

Returns

List<? extends TypeDescriptor>
the parameter types
ResultVerifier getResultVerifier()

getResultVerifier

since 0.30
public ResultVerifier getResultVerifier()

Returns the ResultVerifier to verify the execution result.

Returns

ResultVerifier
either a custom or the default ResultVerifier.
String toString()Described in toString().

toString

since 0.30
public String toString()

Described in toString().

Returns

String
No description.
static Snippet.Builder newBuilder(String, Value, TypeDescriptor)

newBuilder

staticsince 0.30
public static Snippet.Builder newBuilder(
    String id,
    Value executableValue,
    TypeDescriptor executableReturnType
)

Creates a new Snippet builder object.

Parameters

idString
the Snippet identifier The Snippets from a single LanguageProvider with the same identifier but different types are treated as overloads.
executableValueValue
the executable Value used to execute the Snippet
executableReturnTypeTypeDescriptor
the Snippet return type

Returns

Nested types

Inherited members