private static String formatToString(final Object o) { if (o == null) { return "null"; } else if (o instanceof NativeFunction) { return ((NativeFunction) o).toString(); } else if (o instanceof BaseFunction) { return "function " + ((BaseFunction) o).getFunctionName() + "\n" + " [native code]\n" + "}"; } else if (o instanceof NativeArray) { // If an array is embedded inside another array, just return // "[object Object]" return "[object Object]"; } else if (o instanceof Delegator) { return "[object " + ((Delegator) o).getDelegee().getClassName() + "]"; } else if (o instanceof NativeObject) { return "[object " + ((NativeObject) o).getClassName() + "]"; } else if (o instanceof SimpleScriptable) { return "[object " + ((SimpleScriptable) o).getClassName() + "]"; } else { return o.toString(); } }
private static String formatToString(final Object o) { if (o == null) { return "null"; } else if (o instanceof NativeFunction) { return ((NativeFunction) o).toString(); } else if (o instanceof BaseFunction) { return "function " + ((BaseFunction) o).getFunctionName() + "\n" + " [native code]\n" + "}"; } else if (o instanceof NativeArray) { // If an array is embedded inside another array, just return // "[object Object]" return "[object Object]"; } else if (o instanceof Delegator) { return "[object " + ((Delegator) o).getDelegee().getClassName() + "]"; } else if (o instanceof NativeObject) { return "[object " + ((NativeObject) o).getClassName() + "]"; } else if (o instanceof SimpleScriptable) { return "[object " + ((SimpleScriptable) o).getClassName() + "]"; } else { return o.toString(); } }