File: _generated\10\JsonContext.NuGetVersion.g.cs
Web Access
Project: src\src\nuget-client\src\NuGet.Core\NuGet.Protocol\NuGet.Protocol.csproj (NuGet.Protocol)
// <auto-generated/>

#nullable enable annotations
#nullable disable warnings

// Suppress warnings about [Obsolete] member usage in generated code.
#pragma warning disable CS0612, CS0618

namespace NuGet.Protocol.Utility
{
    internal partial class JsonContext
    {
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::NuGet.Versioning.NuGetVersion>? _NuGetVersion;
        
        /// <summary>
        /// Defines the source generated JSON serialization contract metadata for a given type.
        /// </summary>
        #nullable disable annotations // Marking the property type as nullable-oblivious.
        public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::NuGet.Versioning.NuGetVersion> NuGetVersion
        #nullable enable annotations
        {
            get => _NuGetVersion ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::NuGet.Versioning.NuGetVersion>)Options.GetTypeInfo(typeof(global::NuGet.Versioning.NuGetVersion));
        }
        
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::NuGet.Versioning.NuGetVersion> Create_NuGetVersion(global::System.Text.Json.JsonSerializerOptions options)
        {
            if (!TryGetTypeInfoForRuntimeCustomConverter<global::NuGet.Versioning.NuGetVersion>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::NuGet.Versioning.NuGetVersion> jsonTypeInfo))
            {
                var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::NuGet.Versioning.NuGetVersion>
                {
                    ObjectCreator = null,
                    ObjectWithParameterizedConstructorCreator = null,
                    PropertyMetadataInitializer = _ => NuGetVersionPropInit(options),
                    ConstructorParameterMetadataInitializer = null,
                    ConstructorAttributeProviderFactory = null,
                    SerializeHandler = NuGetVersionSerializeHandler,
                };
                
                jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::NuGet.Versioning.NuGetVersion>(options, objectInfo);
                jsonTypeInfo.NumberHandling = null;
            }
        
            jsonTypeInfo.OriginatingResolver = this;
            return jsonTypeInfo;
        }

        private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] NuGetVersionPropInit(global::System.Text.Json.JsonSerializerOptions options)
        {
            var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[13];

            var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<global::System.Version>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::NuGet.Versioning.NuGetVersion),
                Converter = null,
                Getter = static obj => ((global::NuGet.Versioning.NuGetVersion)obj).Version,
                Setter = null,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "Version",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::NuGet.Versioning.NuGetVersion).GetProperty("Version", InstanceMemberBindingFlags, null, typeof(global::System.Version), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::System.Version>(options, info0);
            properties[0].IsGetNullable = false;

            var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<bool>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = true,
                DeclaringType = typeof(global::NuGet.Versioning.NuGetVersion),
                Converter = null,
                Getter = static obj => ((global::NuGet.Versioning.NuGetVersion)obj).IsLegacyVersion,
                Setter = null,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "IsLegacyVersion",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::NuGet.Versioning.NuGetVersion).GetProperty("IsLegacyVersion", InstanceMemberBindingFlags, null, typeof(bool), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<bool>(options, info1);

            var info2 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<int>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::NuGet.Versioning.NuGetVersion),
                Converter = null,
                Getter = static obj => ((global::NuGet.Versioning.NuGetVersion)obj).Revision,
                Setter = null,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "Revision",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::NuGet.Versioning.NuGetVersion).GetProperty("Revision", InstanceMemberBindingFlags, null, typeof(int), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[2] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<int>(options, info2);

            var info3 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<bool>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::NuGet.Versioning.NuGetVersion),
                Converter = null,
                Getter = static obj => ((global::NuGet.Versioning.NuGetVersion)obj).IsSemVer2,
                Setter = null,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "IsSemVer2",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::NuGet.Versioning.NuGetVersion).GetProperty("IsSemVer2", InstanceMemberBindingFlags, null, typeof(bool), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[3] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<bool>(options, info3);

            var info4 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::NuGet.Versioning.NuGetVersion),
                Converter = null,
                Getter = static obj => ((global::NuGet.Versioning.NuGetVersion)obj).OriginalVersion,
                Setter = null,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "OriginalVersion",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::NuGet.Versioning.NuGetVersion).GetProperty("OriginalVersion", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[4] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<string>(options, info4);

            var info5 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<int>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::NuGet.Versioning.SemanticVersion),
                Converter = null,
                Getter = static obj => ((global::NuGet.Versioning.SemanticVersion)obj).Major,
                Setter = null,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "Major",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::NuGet.Versioning.SemanticVersion).GetProperty("Major", InstanceMemberBindingFlags, null, typeof(int), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[5] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<int>(options, info5);

            var info6 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<int>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::NuGet.Versioning.SemanticVersion),
                Converter = null,
                Getter = static obj => ((global::NuGet.Versioning.SemanticVersion)obj).Minor,
                Setter = null,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "Minor",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::NuGet.Versioning.SemanticVersion).GetProperty("Minor", InstanceMemberBindingFlags, null, typeof(int), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[6] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<int>(options, info6);

            var info7 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<int>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::NuGet.Versioning.SemanticVersion),
                Converter = null,
                Getter = static obj => ((global::NuGet.Versioning.SemanticVersion)obj).Patch,
                Setter = null,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "Patch",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::NuGet.Versioning.SemanticVersion).GetProperty("Patch", InstanceMemberBindingFlags, null, typeof(int), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[7] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<int>(options, info7);

            var info8 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<global::System.Collections.Generic.IEnumerable<string>>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::NuGet.Versioning.SemanticVersion),
                Converter = null,
                Getter = static obj => ((global::NuGet.Versioning.SemanticVersion)obj).ReleaseLabels,
                Setter = null,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "ReleaseLabels",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::NuGet.Versioning.SemanticVersion).GetProperty("ReleaseLabels", InstanceMemberBindingFlags, null, typeof(global::System.Collections.Generic.IEnumerable<string>), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[8] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::System.Collections.Generic.IEnumerable<string>>(options, info8);
            properties[8].IsGetNullable = false;

            var info9 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::NuGet.Versioning.SemanticVersion),
                Converter = null,
                Getter = static obj => ((global::NuGet.Versioning.SemanticVersion)obj).Release,
                Setter = null,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "Release",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::NuGet.Versioning.SemanticVersion).GetProperty("Release", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[9] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<string>(options, info9);
            properties[9].IsGetNullable = false;

            var info10 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<bool>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = true,
                DeclaringType = typeof(global::NuGet.Versioning.SemanticVersion),
                Converter = null,
                Getter = static obj => ((global::NuGet.Versioning.SemanticVersion)obj).IsPrerelease,
                Setter = null,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "IsPrerelease",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::NuGet.Versioning.SemanticVersion).GetProperty("IsPrerelease", InstanceMemberBindingFlags, null, typeof(bool), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[10] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<bool>(options, info10);

            var info11 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<bool>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = true,
                DeclaringType = typeof(global::NuGet.Versioning.SemanticVersion),
                Converter = null,
                Getter = static obj => ((global::NuGet.Versioning.SemanticVersion)obj).HasMetadata,
                Setter = null,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "HasMetadata",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::NuGet.Versioning.SemanticVersion).GetProperty("HasMetadata", InstanceMemberBindingFlags, null, typeof(bool), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[11] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<bool>(options, info11);

            var info12 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = true,
                DeclaringType = typeof(global::NuGet.Versioning.SemanticVersion),
                Converter = null,
                Getter = static obj => ((global::NuGet.Versioning.SemanticVersion)obj).Metadata,
                Setter = null,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "Metadata",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::NuGet.Versioning.SemanticVersion).GetProperty("Metadata", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[12] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<string>(options, info12);

            return properties;
        }

        // Intentionally not a static method because we create a delegate to it. Invoking delegates to instance
        // methods is almost as fast as virtual calls. Static methods need to go through a shuffle thunk.
        private void NuGetVersionSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::NuGet.Versioning.NuGetVersion? value)
        {
            if (value is null)
            {
                writer.WriteNullValue();
                return;
            }
            
            writer.WriteStartObject();

            writer.WritePropertyName(PropName_version);
            global::System.Text.Json.JsonSerializer.Serialize(writer, ((global::NuGet.Versioning.NuGetVersion)value).Version, Version);
            writer.WriteBoolean(PropName_isLegacyVersion, ((global::NuGet.Versioning.NuGetVersion)value).IsLegacyVersion);
            writer.WriteNumber(PropName_revision, ((global::NuGet.Versioning.NuGetVersion)value).Revision);
            writer.WriteBoolean(PropName_isSemVer2, ((global::NuGet.Versioning.NuGetVersion)value).IsSemVer2);
            writer.WriteString(PropName_originalVersion, ((global::NuGet.Versioning.NuGetVersion)value).OriginalVersion);
            writer.WriteNumber(PropName_major, ((global::NuGet.Versioning.SemanticVersion)value).Major);
            writer.WriteNumber(PropName_minor, ((global::NuGet.Versioning.SemanticVersion)value).Minor);
            writer.WriteNumber(PropName_patch, ((global::NuGet.Versioning.SemanticVersion)value).Patch);
            writer.WritePropertyName(PropName_releaseLabels);
            IEnumerableStringSerializeHandler(writer, ((global::NuGet.Versioning.SemanticVersion)value).ReleaseLabels);
            writer.WriteString(PropName_release, ((global::NuGet.Versioning.SemanticVersion)value).Release);
            writer.WriteBoolean(PropName_isPrerelease, ((global::NuGet.Versioning.SemanticVersion)value).IsPrerelease);
            writer.WriteBoolean(PropName_hasMetadata, ((global::NuGet.Versioning.SemanticVersion)value).HasMetadata);
            writer.WriteString(PropName_metadata, ((global::NuGet.Versioning.SemanticVersion)value).Metadata);

            writer.WriteEndObject();
        }
    }
}