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

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

            var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<int>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::NuGet.CommandLine.XPlat.SearchMainOutput),
                Converter = null,
                Getter = static obj => ((global::NuGet.CommandLine.XPlat.SearchMainOutput)obj).Version,
                Setter = static (obj, value) => ((global::NuGet.CommandLine.XPlat.SearchMainOutput)obj).Version = value!,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "Version",
                JsonPropertyName = "version",
                AttributeProviderFactory = static () => typeof(global::NuGet.CommandLine.XPlat.SearchMainOutput).GetProperty("Version", 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<global::System.Collections.Generic.List<global::NuGet.CommandLine.XPlat.PackageSearchProblem>>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::NuGet.CommandLine.XPlat.SearchMainOutput),
                Converter = null,
                Getter = static obj => ((global::NuGet.CommandLine.XPlat.SearchMainOutput)obj).Problems,
                Setter = static (obj, value) => ((global::NuGet.CommandLine.XPlat.SearchMainOutput)obj).Problems = value!,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "Problems",
                JsonPropertyName = "problems",
                AttributeProviderFactory = static () => typeof(global::NuGet.CommandLine.XPlat.SearchMainOutput).GetProperty("Problems", InstanceMemberBindingFlags, null, typeof(global::System.Collections.Generic.List<global::NuGet.CommandLine.XPlat.PackageSearchProblem>), 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.CommandLine.XPlat.PackageSearchProblem>>(options, info1);
            properties[1].IsGetNullable = false;
            properties[1].IsSetNullable = false;

            var info2 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<global::System.Collections.Generic.List<global::NuGet.CommandLine.XPlat.PackageSearchResult>>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::NuGet.CommandLine.XPlat.SearchMainOutput),
                Converter = null,
                Getter = static obj => ((global::NuGet.CommandLine.XPlat.SearchMainOutput)obj).SearchResult,
                Setter = static (obj, value) => ((global::NuGet.CommandLine.XPlat.SearchMainOutput)obj).SearchResult = value!,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "SearchResult",
                JsonPropertyName = "searchResult",
                AttributeProviderFactory = static () => typeof(global::NuGet.CommandLine.XPlat.SearchMainOutput).GetProperty("SearchResult", InstanceMemberBindingFlags, null, typeof(global::System.Collections.Generic.List<global::NuGet.CommandLine.XPlat.PackageSearchResult>), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[2] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::System.Collections.Generic.List<global::NuGet.CommandLine.XPlat.PackageSearchResult>>(options, info2);
            properties[2].IsGetNullable = false;
            properties[2].IsSetNullable = 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 SearchMainOutputSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::NuGet.CommandLine.XPlat.SearchMainOutput? value)
        {
            if (value is null)
            {
                writer.WriteNullValue();
                return;
            }
            
            writer.WriteStartObject();

            writer.WriteNumber(PropName_version, ((global::NuGet.CommandLine.XPlat.SearchMainOutput)value).Version);
            writer.WritePropertyName(PropName_problems);
            ListPackageSearchProblemSerializeHandler(writer, ((global::NuGet.CommandLine.XPlat.SearchMainOutput)value).Problems);
            writer.WritePropertyName(PropName_searchResult);
            ListPackageSearchResultSerializeHandler(writer, ((global::NuGet.CommandLine.XPlat.SearchMainOutput)value).SearchResult);

            writer.WriteEndObject();
        }
    }
}