use of jdk.jshell.VarSnippet in project jdk9-jigsaw by AdoptOpenJDK.
the class ShellService method eval.
public synchronized void eval(String command) {
List<SnippetEvent> events = shell.eval(command);
for (SnippetEvent event : events) {
if (event.snippet() instanceof VarSnippet) {
String type = ((VarSnippet) event.snippet()).typeName();
String name = ((VarSnippet) event.snippet()).name();
String value = event.value();
VarData varData = new VarData(type, name, value);
eventBus.publish(Topics.VAR_CREATED_TOPIC, varData);
variables.add(varData);
}
}
}
use of jdk.jshell.VarSnippet in project jdk9-jigsaw by AdoptOpenJDK.
the class JShellSample5 method print.
public static void print(List<SnippetEvent> events) {
for (SnippetEvent event : events) {
if (event.snippet() instanceof VarSnippet) {
String name = ((VarSnippet) event.snippet()).name();
String id = ((VarSnippet) event.snippet()).id();
System.out.println("Variable " + name + " defined with ID " + id);
}
}
}
Aggregations