|
Class: STXTypeEncoder3 (private in JSONTypeEncoder
This class is only visible from within
JSONTypeEncoder.
Object
|
+--JSONTypeEncoder
|
+--JSONTypeEncoder::STXTypeEncoder3
- Package:
- stx:goodies/communication
- Category:
- Net-Communication-JSON
- Owner:
- JSONTypeEncoder
I encode/decode objects as a composite,
consisting of separate type and ref composites wrapping actual
objects.
I can store and reconstruct recursive objects.
queries
-
> typeInfoFormat">typeInfoFormat
-
accessing
-
> canRepresentAnyObject">canRepresentAnyObject
-
-
> canRepresentRecursiveObjects">canRepresentRecursiveObjects
-
-
> idSlotName">idSlotName
-
to overwrite the slotName which provides the id
(if not set, defaults to @id)
-
> refSlotName">refSlotName
-
to overwrite the slotName which provides the ref information
(if not set, defaults to @ref)
-
> typeSlotName">typeSlotName
-
to overwrite the slotName which provides the type information
(if not set, defaults to @type)
-
> valueSlotName">valueSlotName
-
to overwrite the slotName which provides the type information
(if not set, defaults to @value)
protocol
-
> decodeDictionary:">decodeDictionary: aJSONObject
-
this one expects a slot containing @t (typeSlotKey) and @v (valueSlotKey)
and possibly a @id
-
> encodeDictionary:indent:on:using:">encodeDictionary: aDictionary indent: indent on: aStream using: actionForStandardEncoding
-
need more info if its not a Dictionary or if the keys are not all strings.
-
> encodeHelper:on:do:">encodeHelper: anObject on: aStream do: aBlock
-
helper: checks if anObject has already been stored, then outputs a @ref dictionary.
Otherwise, outputs a dictionary containing @id, @type and the object's actual slot values.
aBlock is meant to store the actual contents - this must match what the reader expects
for that particular type (see visiting protocol)
-
> encodeObject:skipNil:indent:on:">encodeObject: anObject skipNil: skipNil indent: indent on: aStream
-
-
> encodeSequenceableCollection:indent:on:using:">encodeSequenceableCollection: aCollection indent: indent on: aStream using: actionForStandardEncoding
-
-
> encodeSet:indent:on:using:">encodeSet: aSet indent: indent on: aStream using: actionForStandardEncoding
-
self encodeObject:v skipNil:false indent:indent on:aStream.
visiting (decoding)
-
> visitDictionary:with:">visitDictionary: inst with: jsonValues
-
this was either written as a standard JSON dictionary
(if there where only string keys),
or as a special key-value array (if there where non-string keys,
or the dictionary was an identity dict).
See encodeDictionary: here
-
> visitObject:with:">visitObject: inst with: jsonValues
-
-
> visitSequenceableCollection:with:">visitSequenceableCollection: inst with: jsonValues
-
-
> visitSet:with:">visitSet: inst with: jsonValues
-
|