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

Method read

javascript/packages/core/lib/gen/map.ts:658–687  ·  view source on GitHub ↗
(accessor: (expr: string) => string, refState: string)

Source from the content-addressed store, hash-verified

656 }
657
658 read(accessor: (expr: string) => string, refState: string): string {
659 const anySerializer = this.builder.getExternal(MapAnySerializer.name);
660 if (!this.isAny()) {
661 return this.readSpecificType(accessor, refState);
662 }
663 const innerSerializer = (innerTypeInfo: TypeInfo) => {
664 return this.scope.declare(
665 "map_inner_ser",
666 TypeId.isNamedType(innerTypeInfo.typeId)
667 ? this.builder.typeResolver.getSerializerByName(
668 CodecBuilder.replaceBackslashAndQuote(innerTypeInfo.named!),
669 )
670 : this.builder.typeResolver.getSerializerById(
671 innerTypeInfo.typeId,
672 innerTypeInfo.userTypeId,
673 ),
674 );
675 };
676 return accessor(
677 `new (${anySerializer})(${this.builder.getWriteContextName()}, ${this.builder.getReadContextName()}, ${
678 this.typeInfo.options!.key!.typeId! !== TypeId.UNKNOWN
679 ? innerSerializer(this.typeInfo.options!.key!)
680 : null
681 }, ${
682 this.typeInfo.options!.value!.typeId !== TypeId.UNKNOWN
683 ? innerSerializer(this.typeInfo.options!.value!)
684 : null
685 }).read(${refState})`,
686 );
687 }
688
689 getFixedSize(): number {
690 return 7;

Callers

nothing calls this directly

Calls 5

isAnyMethod · 0.95
readSpecificTypeMethod · 0.95
getWriteContextNameMethod · 0.80
getReadContextNameMethod · 0.80
getExternalMethod · 0.45

Tested by

no test coverage detected