Snippet (Java SE 19 & JDK 19) (original) (raw)

Direct Known Subclasses:

[ErroneousSnippet](ErroneousSnippet.html "class in jdk.jshell"), [ExpressionSnippet](ExpressionSnippet.html "class in jdk.jshell"), [PersistentSnippet](PersistentSnippet.html "class in jdk.jshell"), [StatementSnippet](StatementSnippet.html "class in jdk.jshell")


public abstract class Snippet extends Object

A Snippet represents a snippet of Java source code as passed toJShell.eval(java.lang.String). It is associated only with theJShell instance that created it. An instance of Snippet (including its subclasses) is immutable: an access to any of its methods will always return the same result. For information about the current state of the snippet within the JShell state engine, query JShell passing the Snippet.

Because it is immutable, Snippet (and subclasses) is thread-safe.

Since:

9

See Also:

Nested Classes
static enum
Describes the general kind of snippet.
static enum
Describes the current state of a Snippet.
static enum
The detailed variety of a snippet.

[id](#id%28%29)()
The unique identifier for the snippet.
[kind](#kind%28%29)()
[source](#source%28%29)()
Return the source code of the snippet.
[subKind](#subKind%28%29)()

Methods declared in class java.lang.Object

[clone](../../../java.base/java/lang/Object.html#clone%28%29), [equals](../../../java.base/java/lang/Object.html#equals%28java.lang.Object%29), [finalize](../../../java.base/java/lang/Object.html#finalize%28%29), [getClass](../../../java.base/java/lang/Object.html#getClass%28%29), [hashCode](../../../java.base/java/lang/Object.html#hashCode%28%29), [notify](../../../java.base/java/lang/Object.html#notify%28%29), [notifyAll](../../../java.base/java/lang/Object.html#notifyAll%28%29), [toString](../../../java.base/java/lang/Object.html#toString%28%29), [wait](../../../java.base/java/lang/Object.html#wait%28%29), [wait](../../../java.base/java/lang/Object.html#wait%28long%29), [wait](../../../java.base/java/lang/Object.html#wait%28long,int%29)