support numbers
This commit is contained in:
parent
e4157cbfb8
commit
8123764154
@ -19,6 +19,9 @@ public class JSONFormatter {
|
|||||||
if (object instanceof String) {
|
if (object instanceof String) {
|
||||||
return formatString((String) object);
|
return formatString((String) object);
|
||||||
}
|
}
|
||||||
|
if (object instanceof Number) {
|
||||||
|
return formatNumber((Number) object);
|
||||||
|
}
|
||||||
if (object instanceof Object[]) {
|
if (object instanceof Object[]) {
|
||||||
return formatArr((Object[]) object);
|
return formatArr((Object[]) object);
|
||||||
}
|
}
|
||||||
@ -52,6 +55,10 @@ public class JSONFormatter {
|
|||||||
return "'" + str + "'";
|
return "'" + str + "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String formatNumber(Number num) {
|
||||||
|
return num.toString();
|
||||||
|
}
|
||||||
|
|
||||||
public String formatList(List<?> list) {
|
public String formatList(List<?> list) {
|
||||||
return formatArr(list.toArray());
|
return formatArr(list.toArray());
|
||||||
}
|
}
|
||||||
|
@ -34,8 +34,8 @@ public class Main {
|
|||||||
}
|
}
|
||||||
String expr = cmdParser.getExpression();
|
String expr = cmdParser.getExpression();
|
||||||
if (expr != null && expr.length() > 0) {
|
if (expr != null && expr.length() > 0) {
|
||||||
scriptClient.execute(expr);
|
Object execute = scriptClient.execute(expr);
|
||||||
console.println(formatter.format(scriptClient.getLastRpcResult()));
|
console.println(formatter.format(execute));
|
||||||
}
|
}
|
||||||
if (cmdParser.isInteractive()) {
|
if (cmdParser.isInteractive()) {
|
||||||
String command = console.readInput();
|
String command = console.readInput();
|
||||||
|
Loading…
Reference in New Issue
Block a user