Package org.mozilla.javascript
Class JavaToJSONConverters
- java.lang.Object
- 
- org.mozilla.javascript.JavaToJSONConverters
 
- 
 public class JavaToJSONConverters extends java.lang.ObjectThis class provides implementations of converters for Java objects to be used by the JSON.stringify method.JSON.stringify will automatically convert instances of java.util.Map to javascript objects. Instances of java.util.Collection and java Arrays will be converted to javascript arrays. This is a final effort at conversion for other java objects that appear as values, and may be preempted by objects which define a toJSON() method or by a replacer function passed to JSON.stringify. The return value will, in turn, be converted according to Context.javaToJS(java.lang.Object, org.mozilla.javascript.Scriptable)and stringified.
- 
- 
Field SummaryFields Modifier and Type Field Description static java.util.function.UnaryOperator<java.lang.Object>BEANConvert JavaBean to an object as long as it has at least one readable propertystatic java.util.function.UnaryOperator<java.lang.Object>EMPTY_OBJECTAlways return an empty objectstatic java.util.function.UnaryOperator<java.lang.Object>STRINGConvert Object to its toString() value.static java.util.function.UnaryOperator<java.lang.Object>THROW_TYPE_ERRORThrow a TypeError naming the class that could not be convertedstatic java.util.function.UnaryOperator<java.lang.Object>UNDEFINEDAlways return undefined
 
- 
- 
- 
Field Detail- 
STRINGpublic static final java.util.function.UnaryOperator<java.lang.Object> STRING Convert Object to its toString() value.
 - 
UNDEFINEDpublic static final java.util.function.UnaryOperator<java.lang.Object> UNDEFINED Always return undefined
 - 
EMPTY_OBJECTpublic static final java.util.function.UnaryOperator<java.lang.Object> EMPTY_OBJECT Always return an empty object
 - 
THROW_TYPE_ERRORpublic static final java.util.function.UnaryOperator<java.lang.Object> THROW_TYPE_ERROR Throw a TypeError naming the class that could not be converted
 - 
BEANpublic static final java.util.function.UnaryOperator<java.lang.Object> BEAN Convert JavaBean to an object as long as it has at least one readable propertyIf unable to determine properties or if none exist, null is returned. This method can be called from other converters to provide an alternate value on a returned null. 
 
- 
 
-