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

Method Reference

go/fory/ref_resolver.go:257–270  ·  view source on GitHub ↗

Reference tracking references relationship. Call this method immediately after composited object such as object array/map/collection/bean is created so that circular reference can be deserialized correctly.

(value reflect.Value)

Source from the content-addressed store, hash-verified

255// Reference tracking references relationship. Call this method immediately after composited object such as
256// object array/map/collection/bean is created so that circular reference can be deserialized correctly.
257func (r *RefResolver) Reference(value reflect.Value) {
258 if !r.refTracking {
259 return
260 }
261 length := len(r.readRefIds)
262 if length == 0 {
263 // No reference to track - this can happen for value types like arrays
264 // that don't participate in reference tracking
265 return
266 }
267 refId := r.readRefIds[length-1]
268 r.readRefIds = r.readRefIds[:length-1]
269 r.SetReadObject(refId, value)
270}
271
272// GetReadObject returns the object for the specified id.
273func (r *RefResolver) GetReadObject(refId int32) reflect.Value {

Callers

nothing calls this directly

Calls 1

SetReadObjectMethod · 0.95

Tested by

no test coverage detected