File: _generated\6\JsonContext.ServiceIndexModel.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.Protocol.Model.ServiceIndexModel>? _ServiceIndexModel;
        
        /// <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.Model.ServiceIndexModel> ServiceIndexModel
        #nullable enable annotations
        {
            get => _ServiceIndexModel ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::NuGet.Protocol.Model.ServiceIndexModel>)Options.GetTypeInfo(typeof(global::NuGet.Protocol.Model.ServiceIndexModel));
        }
        
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::NuGet.Protocol.Model.ServiceIndexModel> Create_ServiceIndexModel(global::System.Text.Json.JsonSerializerOptions options)
        {
            if (!TryGetTypeInfoForRuntimeCustomConverter<global::NuGet.Protocol.Model.ServiceIndexModel>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::NuGet.Protocol.Model.ServiceIndexModel> jsonTypeInfo))
            {
                var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::NuGet.Protocol.Model.ServiceIndexModel>
                {
                    ObjectCreator = null,
                    ObjectWithParameterizedConstructorCreator = static args => new global::NuGet.Protocol.Model.ServiceIndexModel((string)args[0], (global::System.Collections.Generic.List<global::NuGet.Protocol.Model.ServiceIndexEntryModel>)args[1]),
                    PropertyMetadataInitializer = _ => ServiceIndexModelPropInit(options),
                    ConstructorParameterMetadataInitializer = ServiceIndexModelCtorParamInit,
                    ConstructorAttributeProviderFactory = static () => typeof(global::NuGet.Protocol.Model.ServiceIndexModel).GetConstructor(InstanceMemberBindingFlags, binder: null, new[] {typeof(string), typeof(global::System.Collections.Generic.List<global::NuGet.Protocol.Model.ServiceIndexEntryModel>)}, modifiers: null),
                    SerializeHandler = ServiceIndexModelSerializeHandler,
                };
                
                jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::NuGet.Protocol.Model.ServiceIndexModel>(options, objectInfo);
                jsonTypeInfo.NumberHandling = null;
            }
        
            jsonTypeInfo.OriginatingResolver = this;
            return jsonTypeInfo;
        }

        private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] ServiceIndexModelPropInit(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<string>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::NuGet.Protocol.Model.ServiceIndexModel),
                Converter = null,
                Getter = static obj => ((global::NuGet.Protocol.Model.ServiceIndexModel)obj).Version,
                Setter = null,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "Version",
                JsonPropertyName = "version",
                AttributeProviderFactory = static () => typeof(global::NuGet.Protocol.Model.ServiceIndexModel).GetProperty("Version", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<string>(options, info0);
            properties[0].IsGetNullable = false;

            var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<global::System.Collections.Generic.List<global::NuGet.Protocol.Model.ServiceIndexEntryModel>>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::NuGet.Protocol.Model.ServiceIndexModel),
                Converter = null,
                Getter = static obj => ((global::NuGet.Protocol.Model.ServiceIndexModel)obj).Resources,
                Setter = null,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "Resources",
                JsonPropertyName = "resources",
                AttributeProviderFactory = static () => typeof(global::NuGet.Protocol.Model.ServiceIndexModel).GetProperty("Resources", InstanceMemberBindingFlags, null, typeof(global::System.Collections.Generic.List<global::NuGet.Protocol.Model.ServiceIndexEntryModel>), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::System.Collections.Generic.List<global::NuGet.Protocol.Model.ServiceIndexEntryModel>>(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 ServiceIndexModelSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::NuGet.Protocol.Model.ServiceIndexModel? value)
        {
            if (value is null)
            {
                writer.WriteNullValue();
                return;
            }
            
            writer.WriteStartObject();

            writer.WriteString(PropName_version, ((global::NuGet.Protocol.Model.ServiceIndexModel)value).Version);
            writer.WritePropertyName(PropName_resources);
            ListServiceIndexEntryModelSerializeHandler(writer, ((global::NuGet.Protocol.Model.ServiceIndexModel)value).Resources);

            writer.WriteEndObject();
        }

        private static global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[] ServiceIndexModelCtorParamInit() => new global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[]
        {
            new()
            {
                Name = "version",
                ParameterType = typeof(string),
                Position = 0,
                HasDefaultValue = false,
                DefaultValue = null,
                IsNullable = true,
            },

            new()
            {
                Name = "resources",
                ParameterType = typeof(global::System.Collections.Generic.List<global::NuGet.Protocol.Model.ServiceIndexEntryModel>),
                Position = 1,
                HasDefaultValue = false,
                DefaultValue = null,
                IsNullable = true,
            },
        };
    }
}