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

Method ResolveWireTypeId

csharp/src/Fory/TypeResolver.cs:932–958  ·  view source on GitHub ↗
(
        UserTypeKind declaredKind,
        bool registerByName,
        bool compatible,
        bool evolving = true)

Source from the content-addressed store, hash-verified

930 }
931
932 internal static TypeId ResolveWireTypeId(
933 UserTypeKind declaredKind,
934 bool registerByName,
935 bool compatible,
936 bool evolving = true)
937 {
938 if (registerByName)
939 {
940 return declaredKind switch
941 {
942 UserTypeKind.Struct => compatible && evolving ? TypeId.NamedCompatibleStruct : TypeId.NamedStruct,
943 UserTypeKind.Enum => TypeId.NamedEnum,
944 UserTypeKind.Ext => TypeId.NamedExt,
945 UserTypeKind.TypedUnion => TypeId.NamedUnion,
946 _ => throw new InvalidDataException($"unknown user type kind {declaredKind}"),
947 };
948 }
949
950 return declaredKind switch
951 {
952 UserTypeKind.Struct => compatible && evolving ? TypeId.CompatibleStruct : TypeId.Struct,
953 UserTypeKind.Enum => TypeId.Enum,
954 UserTypeKind.Ext => TypeId.Ext,
955 UserTypeKind.TypedUnion => TypeId.TypedUnion,
956 _ => throw new InvalidDataException($"unknown user type kind {declaredKind}"),
957 };
958 }
959
960 private static bool IsKnownTypeId(uint rawTypeId)
961 {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected