---
title: "Snippet"
description: "The unit of execution with assigned parameters and result types."
kind: "class"
id: "org.graalvm.polyglot.tck.Snippet"
module: "polyglot-tck"
version: "25.6.0-elide.4"
canonical: "https://graalvm.elide.help/25.6.0-elide.4/api/polyglot-tck/org/graalvm/polyglot/tck/Snippet.html"
---

# ◆ Snippet

[polyglot-tck](../../../../index.md) › [org.graalvm.polyglot.tck](index.md) · Every page: [llms.txt](../../../../llms.txt)

Class in [`org.graalvm.polyglot.tck`](index.md). Since 0.30.

```java
public final class Snippet
```

Inheritance: [`Object`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html) > `Snippet`

The unit of execution with assigned parameters and result types. The [`Snippet`](Snippet.md) represents an execution of value constructor, statement, expression and script. The [`Snippet`](Snippet.md) provides parameter(s) and return types used to compose the [`Snippet`](Snippet.md)s.

## Nested types

- [`Snippet.Builder`](Snippet.Builder.md) (class): The builder of a Snippet.

## Methods

### getId()
<a id="getId()"></a>`public String getId()`. Since 0.30. Returns the identifier of a snippet. The `Snippet`s from a single `LanguageProvider` with the same identifier but different types are treated as overloads. Returns `String`: the `Snippet` identifier. Cite: `org/graalvm/polyglot/tck/Snippet.html#getId()`

### getExecutableValue()
<a id="getExecutableValue()"></a>`public Value getExecutableValue()`. Since 0.30. Returns the function executing the `Snippet`. Returns `Value`: the executable [`Value`](https://graalvm.elide.help/25.6.0-elide.4/api/polyglot/org/graalvm/polyglot/Value.html). Cite: `org/graalvm/polyglot/tck/Snippet.html#getExecutableValue()`

### getReturnType()
<a id="getReturnType()"></a>`public TypeDescriptor getReturnType()`. Since 0.30. Returns the `Snippet` return type. Returns `TypeDescriptor`: the return type. Cite: `org/graalvm/polyglot/tck/Snippet.html#getReturnType()`

### getParameterTypes()
<a id="getParameterTypes()"></a>`public List<? extends TypeDescriptor> getParameterTypes()`. Since 0.30. Returns the types of `Snippet` formal parameters. Returns `List<? extends TypeDescriptor>`: the parameter types. Cite: `org/graalvm/polyglot/tck/Snippet.html#getParameterTypes()`

### getResultVerifier()
<a id="getResultVerifier()"></a>`public ResultVerifier getResultVerifier()`. Since 0.30. Returns the `ResultVerifier` to verify the execution result. Returns `ResultVerifier`: either a custom or the default `ResultVerifier`. Cite: `org/graalvm/polyglot/tck/Snippet.html#getResultVerifier()`

### toString()
<a id="toString()"></a>`public String toString()`. Since 0.30. Overrides `toString()`. Cite: `org/graalvm/polyglot/tck/Snippet.html#toString()`

### newBuilder(String, Value, TypeDescriptor)
<a id="newBuilder(java.lang.String,org.graalvm.polyglot.Value,org.graalvm.polyglot.tck.TypeDescriptor)"></a>`public static Snippet.Builder newBuilder(String id, Value executableValue, TypeDescriptor executableReturnType)`. Since 0.30. Creates a new `Snippet` builder object. Parameters: `id` `String`: the `Snippet` identifier The `Snippet`s from a single `LanguageProvider` with the same identifier but different types are treated as overloads. `executableValue` `Value`: the executable [`Value`](https://graalvm.elide.help/25.6.0-elide.4/api/polyglot/org/graalvm/polyglot/Value.html) used to execute the `Snippet`. `executableReturnType` `TypeDescriptor`: the `Snippet` return type. Returns `Snippet.Builder`: the new `Builder`. Cite: `org/graalvm/polyglot/tck/Snippet.html#newBuilder(java.lang.String,org.graalvm.polyglot.Value,org.graalvm.polyglot.tck.TypeDescriptor)`

## Inherited members

- From class [`Object`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html): [`equals`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#equals%28java.lang.Object%29), [`getClass`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#getClass%28%29), [`hashCode`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#hashCode%28%29), [`notify`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notify%28%29), [`notifyAll`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notifyAll%28%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28long%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28long,int%29)
