public class SnippetEvent extends Object
JShell.eval(String)
or JShell.drop(Snippet)
, or indirectly by these same methods as dependencies change or Snippets are overwritten. For direct changes, the causeSnippet()
is null
. SnippetEvent
is immutable: an access to any of its methods will always return the same result. and thus is thread-safe.
Modifier and Type | Method | Description |
---|---|---|
Snippet |
causeSnippet() |
Either the snippet whose change caused this update or null . |
JShellException |
exception() |
An instance of UnresolvedReferenceException , if an unresolved reference was encountered, or an instance of EvalException if an exception was thrown during execution, otherwise null . |
boolean |
isSignatureChange() |
Indicates whether the signature has changed. |
Snippet.Status |
previousStatus() |
The status before the transition. |
Snippet |
snippet() |
The Snippet which has changed |
Snippet.Status |
status() |
The after status. |
String |
toString() |
Return a string representation of the event |
String |
value() |
The result value of successful run. |
public Snippet snippet()
Status
has changed.public Snippet.Status previousStatus()
NONEXISTENT
.public Snippet.Status status()
Status
change.public boolean isSignatureChange()
(status == OVERWRITTEN)
is always false
as responsibility for the definition has passed to the overwriting definition.true
if the signature changed; otherwise false
public Snippet causeSnippet()
null
. This returns null
if this change is the creation of a new Snippet via eval
or it is the explicit drop of a Snippet with drop
.null
if directly caused by an API action.public JShellException exception()
UnresolvedReferenceException
, if an unresolved reference was encountered, or an instance of EvalException
if an exception was thrown during execution, otherwise null
.null
.public String value()
null
.public String toString()
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/jdk.jshell/jdk/jshell/SnippetEvent.html