File: _generated\84\PluginJsonContext.SemanticVersion.g.cs
Web Access
Project: 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.Plugins
{
    internal partial class PluginJsonContext
    {
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::NuGet.Versioning.SemanticVersion>? _SemanticVersion;
        
        /// <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.SemanticVersion> SemanticVersion
        #nullable enable annotations
        {
            get => _SemanticVersion ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::NuGet.Versioning.SemanticVersion>)Options.GetTypeInfo(typeof(global::NuGet.Versioning.SemanticVersion));
        }
        
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::NuGet.Versioning.SemanticVersion> Create_SemanticVersion(global::System.Text.Json.JsonSerializerOptions options)
        {
            if (!TryGetTypeInfoForRuntimeCustomConverter<global::NuGet.Versioning.SemanticVersion>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::NuGet.Versioning.SemanticVersion> jsonTypeInfo))
            {
                var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::NuGet.Versioning.SemanticVersion>
                {
                    ObjectCreator = null,
                    ObjectWithParameterizedConstructorCreator = null,
                    PropertyMetadataInitializer = _ => SemanticVersionPropInit(options),
                    ConstructorParameterMetadataInitializer = null,
                    ConstructorAttributeProviderFactory = null,
                    SerializeHandler = SemanticVersionSerializeHandler,
                    PolymorphismOptions = new global::System.Text.Json.Serialization.Metadata.JsonPolymorphismOptions(),
                    TypeClassifierFactory = null,
                };
                
                jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::NuGet.Versioning.SemanticVersion>(options, objectInfo);
                jsonTypeInfo.NumberHandling = null;
            }
        
            jsonTypeInfo.OriginatingResolver = this;
            return jsonTypeInfo;
        }

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

            var info0 = 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[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<int>(options, info0);

            var info1 = 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[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<int>(options, info1);

            var info2 = 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[2] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<int>(options, info2);

            var info3 = 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[3] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::System.Collections.Generic.IEnumerable<string>>(options, info3);
            properties[3].IsGetNullable = false;

            var info4 = 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[4] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<string>(options, info4);
            properties[4].IsGetNullable = false;

            var info5 = 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[5] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<bool>(options, info5);

            var info6 = 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[6] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<bool>(options, info6);

            var info7 = 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[7] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<string>(options, info7);

            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 SemanticVersionSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::NuGet.Versioning.SemanticVersion? value)
        {
            if (value is null)
            {
                writer.WriteNullValue();
                return;
            }
            
            writer.WriteStartObject();

            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);
            global::System.Collections.Generic.IEnumerable<string> __value_ReleaseLabels = ((global::NuGet.Versioning.SemanticVersion)value).ReleaseLabels;
            if (__value_ReleaseLabels is not null)
            {
                writer.WritePropertyName(PropName_ReleaseLabels);
                IEnumerableStringSerializeHandler(writer, __value_ReleaseLabels);
            }
            string __value_Release = ((global::NuGet.Versioning.SemanticVersion)value).Release;
            if (__value_Release is not null)
            {
                writer.WriteString(PropName_Release, __value_Release);
            }
            writer.WriteBoolean(PropName_IsPrerelease, ((global::NuGet.Versioning.SemanticVersion)value).IsPrerelease);
            writer.WriteBoolean(PropName_HasMetadata, ((global::NuGet.Versioning.SemanticVersion)value).HasMetadata);
            string __value_Metadata = ((global::NuGet.Versioning.SemanticVersion)value).Metadata;
            if (__value_Metadata is not null)
            {
                writer.WriteString(PropName_Metadata, __value_Metadata);
            }

            writer.WriteEndObject();
        }
    }
}