File: _generated\14\PackageSearchJsonContext.PackageVulnerabilityMetadata.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.Protocol.PackageVulnerabilityMetadata>? _PackageVulnerabilityMetadata;
        
        /// <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.Protocol.PackageVulnerabilityMetadata> PackageVulnerabilityMetadata
        #nullable enable annotations
        {
            get => _PackageVulnerabilityMetadata ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::NuGet.Protocol.PackageVulnerabilityMetadata>)Options.GetTypeInfo(typeof(global::NuGet.Protocol.PackageVulnerabilityMetadata));
        }
        
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::NuGet.Protocol.PackageVulnerabilityMetadata> Create_PackageVulnerabilityMetadata(global::System.Text.Json.JsonSerializerOptions options)
        {
            if (!TryGetTypeInfoForRuntimeCustomConverter<global::NuGet.Protocol.PackageVulnerabilityMetadata>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::NuGet.Protocol.PackageVulnerabilityMetadata> jsonTypeInfo))
            {
                var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::NuGet.Protocol.PackageVulnerabilityMetadata>
                {
                    ObjectCreator = () => new global::NuGet.Protocol.PackageVulnerabilityMetadata(),
                    ObjectWithParameterizedConstructorCreator = null,
                    PropertyMetadataInitializer = _ => PackageVulnerabilityMetadataPropInit(options),
                    ConstructorParameterMetadataInitializer = null,
                    ConstructorAttributeProviderFactory = static () => typeof(global::NuGet.Protocol.PackageVulnerabilityMetadata).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty<global::System.Type>(), modifiers: null),
                    SerializeHandler = PackageVulnerabilityMetadataSerializeHandler,
                };
                
                jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::NuGet.Protocol.PackageVulnerabilityMetadata>(options, objectInfo);
                jsonTypeInfo.NumberHandling = null;
            }
        
            jsonTypeInfo.OriginatingResolver = this;
            return jsonTypeInfo;
        }

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

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

            var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<int>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::NuGet.Protocol.PackageVulnerabilityMetadata),
                Converter = null,
                Getter = static obj => ((global::NuGet.Protocol.PackageVulnerabilityMetadata)obj).Severity,
                Setter = null,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "Severity",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::NuGet.Protocol.PackageVulnerabilityMetadata).GetProperty("Severity", 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);

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

            writer.WritePropertyName(PropName_AdvisoryUrl);
            global::System.Text.Json.JsonSerializer.Serialize(writer, ((global::NuGet.Protocol.PackageVulnerabilityMetadata)value).AdvisoryUrl, Uri);
            writer.WriteNumber(PropName_Severity, ((global::NuGet.Protocol.PackageVulnerabilityMetadata)value).Severity);

            writer.WriteEndObject();
        }
    }
}