public class RhinoUtils extends Object
This class can be used directly in Rhino.
This class was inspired from ://mongodb-rhino.googlecode.com/svn/trunk/modules/com.mongodb.rhino/src/com/mongodb/rhino/JSON.java
| Modifier and Type | Method and Description |
|---|---|
static String |
createExceptionMessage(org.mozilla.javascript.RhinoException e)
Creates a more detailed message based on
RhinoException thrown by rhino execution. |
static String |
toJson(Object object)
Recursively convert from native Rhino to JSON.
|
static String |
toJson(Object object,
boolean indent)
Recursively convert from native Rhino to JSON.
|
public static String createExceptionMessage(org.mozilla.javascript.RhinoException e)
RhinoException thrown by rhino execution. The message will contain
a detailed description of the problem by inspecting the JSON value provided by exception.e - RhinoException thrown by rhino execution.public static String toJson(Object object)
Recognizes JavaScript objects, arrays and primitives.
Special support for JavaScript dates: converts to {"$date": timestamp} in JSON.
Special support for MongoDB ObjectId: converts to {"$oid": "objectid"} in JSON.
Also recognizes JVM types: java.util.Map, java.util.Collection, java.util.Date.
object - A Rhino native objectRhinoUtils#convertSpecial(Object)public static String toJson(Object object, boolean indent)
Recognizes JavaScript objects, arrays and primitives.
Special support for JavaScript dates: converts to {"$date": timestamp} in JSON.
Special support for MongoDB ObjectId: converts to {"$oid": "objectid"} in JSON.
Also recognizes JVM types: java.util.Map, java.util.Collection, java.util.Date.
object - A Rhino native objectindent - Whether to indent the JSON for human readabilityCopyright © 2008-2013. All Rights Reserved.