# Uses of Class
jdk.jshell.Snippet

Packages that use Snippet
Package
Description
jdk.jshell
Provides interfaces for creating tools, such as a Read-Eval-Print Loop (REPL), which interactively evaluate "snippets" of Java programming language code.

## Uses of Snippet in jdk.jshell

Subclasses of Snippet in jdk.jshell
Modifier and Type
Class
Description
`class`
`DeclarationSnippet`
Grouping for all declaration Snippets: variable declarations (`VarSnippet`), method declarations (`MethodSnippet`), and type declarations (`TypeDeclSnippet`).
`class`
`ErroneousSnippet`
A snippet of code that is not valid Java programming language code.
`class`
`ExpressionSnippet`
Snippet for an assignment or variable-value expression.
`class`
`ImportSnippet`
Snippet for an import declaration.
`class`
`MethodSnippet`
Snippet for a method definition.
`class`
`PersistentSnippet`
Grouping for Snippets which persist and influence future code.
`class`
`StatementSnippet`
Snippet for a statement.
`class`
`TypeDeclSnippet`
Snippet for a type definition (a class, interface, enum, or annotation interface definition).
`class`
`VarSnippet`
Snippet for a variable definition.
Methods in jdk.jshell that return Snippet
Modifier and Type
Method
Description
`Snippet`
SnippetEvent.`causeSnippet()`
Either the snippet whose change caused this update or `null`.
`Snippet`
SnippetEvent.`snippet()`
The Snippet which has changed
Methods in jdk.jshell that return types with arguments of type Snippet
Modifier and Type
Method
Description
`abstract Collection<Snippet>`
SourceCodeAnalysis.`dependents(Snippet snippet)`
Returns a collection of `Snippet`s which might need updating if the given `Snippet` is updated.
`Stream<Snippet>`
JShell.`snippets()`
Return all snippets.
`abstract List<Snippet>`
SourceCodeAnalysis.`sourceToSnippets(String input)`
Converts the source code of a snippet into a `Snippet` object (or list of `Snippet` objects in the case of some var declarations, e.g.: int x, y, z;).
Methods in jdk.jshell with parameters of type Snippet
Modifier and Type
Method
Description
`abstract Collection<Snippet>`
SourceCodeAnalysis.`dependents(Snippet snippet)`
Returns a collection of `Snippet`s which might need updating if the given `Snippet` is updated.
`Stream<Diag>`
JShell.`diagnostics(Snippet snippet)`
Return the diagnostics of the most recent evaluation of the snippet.
`List<SnippetEvent>`
JShell.`drop(Snippet snippet)`
Remove a declaration from the state.
`Snippet.Status`
JShell.`status(Snippet snippet)`
Return the status of the snippet.
`abstract SourceCodeAnalysis.SnippetWrapper`
SourceCodeAnalysis.`wrapper(Snippet snippet)`
Returns the wrapper information for the `Snippet`.
Method parameters in jdk.jshell with type arguments of type Snippet
Modifier and Type
Method
Description
`JShell.Builder`
JShell.Builder.`idGenerator(BiFunction<Snippet,Integer,String> generator)`
Sets the generator of identifying names for Snippets.