Package org.mozilla.javascript
Class NativeJSON
- java.lang.Object
-
- org.mozilla.javascript.ScriptableObject
-
- org.mozilla.javascript.IdScriptableObject
-
- org.mozilla.javascript.NativeJSON
-
- All Implemented Interfaces:
java.io.Serializable,ConstProperties,DebuggableObject,IdFunctionCall,Scriptable,SymbolScriptable
public final class NativeJSON extends IdScriptableObject
This class implements the JSON native object. See ECMA 15.12.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classNativeJSON.StringifyState-
Nested classes/interfaces inherited from class org.mozilla.javascript.ScriptableObject
ScriptableObject.KeyComparator
-
-
Field Summary
Fields Modifier and Type Field Description private static intId_parseprivate static intId_stringifyprivate static intId_toSourceprivate static java.lang.ObjectJSON_TAGprivate static intLAST_METHOD_IDprivate static intMAX_IDprivate static intMAX_STRINGIFY_GAP_LENGTHprivate static longserialVersionUID-
Fields inherited from class org.mozilla.javascript.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
-
Fields inherited from interface org.mozilla.javascript.Scriptable
NOT_FOUND
-
-
Constructor Summary
Constructors Modifier Constructor Description privateNativeJSON()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ObjectexecIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)'thisObj' will be null if invoked as constructor, in which case * instance of Scriptable should be returned.protected intfindPrototypeId(java.lang.String s)java.lang.StringgetClassName()Return the name of the class.(package private) static voidinit(Scriptable scope, boolean sealed)protected voidinitPrototypeId(int id)private static booleanisObjectArrayLike(java.lang.Object o)private static java.lang.Stringja(Scriptable value, NativeJSON.StringifyState state)private static java.lang.ObjectjavaToJSON(java.lang.Object value, NativeJSON.StringifyState state)private static java.lang.Stringjo(Scriptable value, NativeJSON.StringifyState state)private static java.lang.Stringjoin(java.util.Collection<java.lang.Object> objs, java.lang.String delimiter)private static java.lang.Objectparse(Context cx, Scriptable scope, java.lang.String jtext)static java.lang.Objectparse(Context cx, Scriptable scope, java.lang.String jtext, Callable reviver)private static java.lang.Stringquote(java.lang.String string)private static java.lang.Stringrepeat(char c, int count)private static java.lang.Objectstr(java.lang.Object key, Scriptable holder, NativeJSON.StringifyState state)static java.lang.Objectstringify(Context cx, Scriptable scope, java.lang.Object value, java.lang.Object replacer, java.lang.Object space)private static java.lang.Objectwalk(Context cx, Scriptable scope, Callable reviver, Scriptable holder, java.lang.Object name)-
Methods inherited from class org.mozilla.javascript.IdScriptableObject
activatePrototypeMap, addIdFunctionProperty, defaultGet, defaultHas, defaultPut, defineOwnProperty, delete, delete, ensureType, exportAsJSClass, fillConstructorProperties, findInstanceIdInfo, findInstanceIdInfo, findPrototypeId, get, get, getAttributes, getAttributes, getIds, getInstanceIdName, getInstanceIdValue, getMaxInstanceId, getOwnPropertyDescriptor, has, has, hasPrototypeMap, initPrototypeConstructor, initPrototypeMethod, initPrototypeMethod, initPrototypeMethod, initPrototypeValue, initPrototypeValue, instanceIdInfo, put, put, setAttributes, setInstanceIdAttributes, setInstanceIdValue
-
Methods inherited from class org.mozilla.javascript.ScriptableObject
addLazilyInitializedValue, applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildClassCtor, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, checkValidAttributes, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, equivalentValues, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, hasInstance, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, putConst, putConstProperty, putProperty, putProperty, putProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setParentScope, setPrototype, size
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
JSON_TAG
private static final java.lang.Object JSON_TAG
-
MAX_STRINGIFY_GAP_LENGTH
private static final int MAX_STRINGIFY_GAP_LENGTH
- See Also:
- Constant Field Values
-
Id_toSource
private static final int Id_toSource
- See Also:
- Constant Field Values
-
Id_parse
private static final int Id_parse
- See Also:
- Constant Field Values
-
Id_stringify
private static final int Id_stringify
- See Also:
- Constant Field Values
-
LAST_METHOD_ID
private static final int LAST_METHOD_ID
- See Also:
- Constant Field Values
-
MAX_ID
private static final int MAX_ID
- See Also:
- Constant Field Values
-
-
Method Detail
-
init
static void init(Scriptable scope, boolean sealed)
-
getClassName
public java.lang.String getClassName()
Description copied from class:ScriptableObjectReturn the name of the class.This is typically the same name as the constructor. Classes extending ScriptableObject must implement this abstract method.
- Specified by:
getClassNamein interfaceScriptable- Specified by:
getClassNamein classScriptableObject
-
initPrototypeId
protected void initPrototypeId(int id)
- Overrides:
initPrototypeIdin classIdScriptableObject
-
execIdCall
public java.lang.Object execIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
Description copied from class:IdScriptableObject'thisObj' will be null if invoked as constructor, in which case * instance of Scriptable should be returned.- Specified by:
execIdCallin interfaceIdFunctionCall- Overrides:
execIdCallin classIdScriptableObject
-
parse
private static java.lang.Object parse(Context cx, Scriptable scope, java.lang.String jtext)
-
parse
public static java.lang.Object parse(Context cx, Scriptable scope, java.lang.String jtext, Callable reviver)
-
walk
private static java.lang.Object walk(Context cx, Scriptable scope, Callable reviver, Scriptable holder, java.lang.Object name)
-
repeat
private static java.lang.String repeat(char c, int count)
-
stringify
public static java.lang.Object stringify(Context cx, Scriptable scope, java.lang.Object value, java.lang.Object replacer, java.lang.Object space)
-
str
private static java.lang.Object str(java.lang.Object key, Scriptable holder, NativeJSON.StringifyState state)
-
join
private static java.lang.String join(java.util.Collection<java.lang.Object> objs, java.lang.String delimiter)
-
jo
private static java.lang.String jo(Scriptable value, NativeJSON.StringifyState state)
-
ja
private static java.lang.String ja(Scriptable value, NativeJSON.StringifyState state)
-
quote
private static java.lang.String quote(java.lang.String string)
-
javaToJSON
private static java.lang.Object javaToJSON(java.lang.Object value, NativeJSON.StringifyState state)
-
isObjectArrayLike
private static boolean isObjectArrayLike(java.lang.Object o)
-
findPrototypeId
protected int findPrototypeId(java.lang.String s)
- Overrides:
findPrototypeIdin classIdScriptableObject
-
-