|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ro.isdc.wro.extensions.script.RhinoUtils
public class RhinoUtils
Direct conversion between native Rhino objects and JSON.
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
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
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 object
RhinoUtils#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 readability
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |