File: _generated\8\PackageSearchJsonContext.LicenseMetadata.g.cs
Web Access
Project: src\src\nuget-client\src\NuGet.Core\NuGet.CommandLine.XPlat\NuGet.CommandLine.XPlat.csproj (NuGet.CommandLine.XPlat)
// <auto-generated/>

#nullable enable annotations
#nullable disable warnings

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

namespace NuGet.CommandLine.XPlat
{
    internal partial class PackageSearchJsonContext
    {
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::NuGet.Packaging.LicenseMetadata>? _LicenseMetadata;
        
        /// <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.Packaging.LicenseMetadata> LicenseMetadata
        #nullable enable annotations
        {
            get => _LicenseMetadata ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::NuGet.Packaging.LicenseMetadata>)Options.GetTypeInfo(typeof(global::NuGet.Packaging.LicenseMetadata));
        }
        
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::NuGet.Packaging.LicenseMetadata> Create_LicenseMetadata(global::System.Text.Json.JsonSerializerOptions options)
        {
            if (!TryGetTypeInfoForRuntimeCustomConverter<global::NuGet.Packaging.LicenseMetadata>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::NuGet.Packaging.LicenseMetadata> jsonTypeInfo))
            {
                var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::NuGet.Packaging.LicenseMetadata>
                {
                    ObjectCreator = null,
                    ObjectWithParameterizedConstructorCreator = static args => new global::NuGet.Packaging.LicenseMetadata((global::NuGet.Packaging.LicenseType)args[0], (string)args[1], (global::NuGet.Packaging.Licenses.NuGetLicenseExpression)args[2], (global::System.Collections.Generic.IReadOnlyList<string>)args[3], (global::System.Version)args[4]),
                    PropertyMetadataInitializer = _ => LicenseMetadataPropInit(options),
                    ConstructorParameterMetadataInitializer = LicenseMetadataCtorParamInit,
                    ConstructorAttributeProviderFactory = static () => typeof(global::NuGet.Packaging.LicenseMetadata).GetConstructor(InstanceMemberBindingFlags, binder: null, new[] {typeof(global::NuGet.Packaging.LicenseType), typeof(string), typeof(global::NuGet.Packaging.Licenses.NuGetLicenseExpression), typeof(global::System.Collections.Generic.IReadOnlyList<string>), typeof(global::System.Version)}, modifiers: null),
                    SerializeHandler = LicenseMetadataSerializeHandler,
                };
                
                jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::NuGet.Packaging.LicenseMetadata>(options, objectInfo);
                jsonTypeInfo.NumberHandling = null;
            }
        
            jsonTypeInfo.OriginatingResolver = this;
            return jsonTypeInfo;
        }

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

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

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

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

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

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

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

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

            writer.WritePropertyName(PropName_Type);
            global::System.Text.Json.JsonSerializer.Serialize(writer, ((global::NuGet.Packaging.LicenseMetadata)value).Type, LicenseType);
            writer.WriteString(PropName_License, ((global::NuGet.Packaging.LicenseMetadata)value).License);
            writer.WritePropertyName(PropName_LicenseExpression);
            NuGetLicenseExpressionSerializeHandler(writer, ((global::NuGet.Packaging.LicenseMetadata)value).LicenseExpression);
            writer.WritePropertyName(PropName_WarningsAndErrors);
            IReadOnlyListStringSerializeHandler(writer, ((global::NuGet.Packaging.LicenseMetadata)value).WarningsAndErrors);
            writer.WritePropertyName(PropName_Version);
            global::System.Text.Json.JsonSerializer.Serialize(writer, ((global::NuGet.Packaging.LicenseMetadata)value).Version, Version);
            writer.WritePropertyName(PropName_LicenseUrl);
            global::System.Text.Json.JsonSerializer.Serialize(writer, ((global::NuGet.Packaging.LicenseMetadata)value).LicenseUrl, Uri);

            writer.WriteEndObject();
        }

        private static global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[] LicenseMetadataCtorParamInit() => new global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[]
        {
            new()
            {
                Name = "type",
                ParameterType = typeof(global::NuGet.Packaging.LicenseType),
                Position = 0,
                HasDefaultValue = false,
                DefaultValue = null,
                IsNullable = false,
            },

            new()
            {
                Name = "license",
                ParameterType = typeof(string),
                Position = 1,
                HasDefaultValue = false,
                DefaultValue = null,
                IsNullable = false,
            },

            new()
            {
                Name = "expression",
                ParameterType = typeof(global::NuGet.Packaging.Licenses.NuGetLicenseExpression),
                Position = 2,
                HasDefaultValue = false,
                DefaultValue = null,
                IsNullable = true,
            },

            new()
            {
                Name = "warningsAndErrors",
                ParameterType = typeof(global::System.Collections.Generic.IReadOnlyList<string>),
                Position = 3,
                HasDefaultValue = false,
                DefaultValue = null,
                IsNullable = true,
            },

            new()
            {
                Name = "version",
                ParameterType = typeof(global::System.Version),
                Position = 4,
                HasDefaultValue = false,
                DefaultValue = null,
                IsNullable = false,
            },
        };
    }
}