MCPcopy Create free account
hub / github.com/apache/fory / SetReadObject

Method SetReadObject

go/fory/ref_resolver.go:293–306  ·  view source on GitHub ↗

SetReadObject sets the id for an object that has been read. id: The id from #NextReadRefId. object: the object that has been read

(refId int32, value reflect.Value)

Source from the content-addressed store, hash-verified

291// id: The id from {@link #NextReadRefId}.
292// object: the object that has been read
293func (r *RefResolver) SetReadObject(refId int32, value reflect.Value) {
294 if !r.refTracking {
295 return
296 }
297 if refId >= 0 {
298 r.readObjects[refId] = value
299 // Consume the preserved ref id if it's the most recent.
300 // This keeps the readRefIds stack in sync for serializers that
301 // set the object directly instead of calling Reference().
302 if n := len(r.readRefIds); n > 0 && r.readRefIds[n-1] == refId {
303 r.readRefIds = r.readRefIds[:n-1]
304 }
305 }
306}
307
308func (r *RefResolver) reset() {
309 r.resetRead()

Callers 8

ReferenceMethod · 0.95
readDifferentTypesMethod · 0.80
readSameTypeMethod · 0.80
readDifferentTypesMethod · 0.80
ReadValueMethod · 0.80
ReadStructMethod · 0.80
ReadArrayValueMethod · 0.80

Calls

no outgoing calls

Tested by 1