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 class
NativeJSON.StringifyState
-
Nested classes/interfaces inherited from class org.mozilla.javascript.ScriptableObject
ScriptableObject.GetterSlot, ScriptableObject.KeyComparator, ScriptableObject.Slot, ScriptableObject.SlotAccess
-
-
Field Summary
Fields Modifier and Type Field Description private static int
Id_parse
private static int
Id_stringify
private static int
Id_toSource
private static java.lang.Object
JSON_TAG
private static int
LAST_METHOD_ID
private static int
MAX_ID
private static int
MAX_STRINGIFY_GAP_LENGTH
private static long
serialVersionUID
-
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 private
NativeJSON()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
execIdCall(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 int
findPrototypeId(java.lang.String s)
java.lang.String
getClassName()
Return the name of the class.(package private) static void
init(Scriptable scope, boolean sealed)
protected void
initPrototypeId(int id)
private static java.lang.String
ja(NativeArray value, NativeJSON.StringifyState state)
private static java.lang.String
jo(Scriptable value, NativeJSON.StringifyState state)
private static java.lang.String
join(java.util.Collection<java.lang.Object> objs, java.lang.String delimiter)
private static java.lang.Object
parse(Context cx, Scriptable scope, java.lang.String jtext)
static java.lang.Object
parse(Context cx, Scriptable scope, java.lang.String jtext, Callable reviver)
private static java.lang.String
quote(java.lang.String string)
private static java.lang.String
repeat(char c, int count)
private static java.lang.Object
str(java.lang.Object key, Scriptable holder, NativeJSON.StringifyState state)
static java.lang.Object
stringify(Context cx, Scriptable scope, java.lang.Object value, java.lang.Object replacer, java.lang.Object space)
private static java.lang.Object
walk(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, exportAsJSClass, fillConstructorProperties, findInstanceIdInfo, findInstanceIdInfo, findPrototypeId, get, get, getAttributes, getAttributes, getIds, getInstanceIdName, getInstanceIdValue, getMaxInstanceId, getOwnPropertyDescriptor, has, has, hasPrototypeMap, incompatibleCallError, 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, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, equivalentValues, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getSlot, 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, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, 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:ScriptableObject
Return the name of the class. This is typically the same name as the constructor. Classes extending ScriptableObject must implement this abstract method.- Specified by:
getClassName
in interfaceScriptable
- Specified by:
getClassName
in classScriptableObject
-
initPrototypeId
protected void initPrototypeId(int id)
- Overrides:
initPrototypeId
in 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:
execIdCall
in interfaceIdFunctionCall
- Overrides:
execIdCall
in 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(NativeArray value, NativeJSON.StringifyState state)
-
quote
private static java.lang.String quote(java.lang.String string)
-
findPrototypeId
protected int findPrototypeId(java.lang.String s)
- Overrides:
findPrototypeId
in classIdScriptableObject
-
-