File: _generated\59\ToolListJsonSerializerContext.ToolListJsonContract.g.cs
Web Access
Project: src\src\sdk\src\Cli\dotnet\dotnet.csproj (dotnet)
// <auto-generated/>

#nullable enable annotations
#nullable disable warnings

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

namespace Microsoft.DotNet.Cli.Commands.Tool.List
{
    internal partial class ToolListJsonSerializerContext
    {
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.DotNet.Cli.Commands.Tool.List.ToolListJsonContract>? _ToolListJsonContract;
        
        /// <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::Microsoft.DotNet.Cli.Commands.Tool.List.ToolListJsonContract> ToolListJsonContract
        #nullable enable annotations
        {
            get => _ToolListJsonContract ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.DotNet.Cli.Commands.Tool.List.ToolListJsonContract>)Options.GetTypeInfo(typeof(global::Microsoft.DotNet.Cli.Commands.Tool.List.ToolListJsonContract));
        }
        
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.DotNet.Cli.Commands.Tool.List.ToolListJsonContract> Create_ToolListJsonContract(global::System.Text.Json.JsonSerializerOptions options)
        {
            if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.DotNet.Cli.Commands.Tool.List.ToolListJsonContract>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.DotNet.Cli.Commands.Tool.List.ToolListJsonContract> jsonTypeInfo))
            {
                var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Microsoft.DotNet.Cli.Commands.Tool.List.ToolListJsonContract>
                {
                    ObjectCreator = null,
                    ObjectWithParameterizedConstructorCreator = static args => new global::Microsoft.DotNet.Cli.Commands.Tool.List.ToolListJsonContract(){ PackageId = (string)args[0], Version = (string)args[1], Commands = (string[])args[2] },
                    PropertyMetadataInitializer = _ => ToolListJsonContractPropInit(options),
                    ConstructorParameterMetadataInitializer = ToolListJsonContractCtorParamInit,
                    ConstructorAttributeProviderFactory = static () => typeof(global::Microsoft.DotNet.Cli.Commands.Tool.List.ToolListJsonContract).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty<global::System.Type>(), modifiers: null),
                    SerializeHandler = ToolListJsonContractSerializeHandler,
                };
                
                jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Microsoft.DotNet.Cli.Commands.Tool.List.ToolListJsonContract>(options, objectInfo);
                jsonTypeInfo.NumberHandling = null;
            }
        
            jsonTypeInfo.OriginatingResolver = this;
            return jsonTypeInfo;
        }

        private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] ToolListJsonContractPropInit(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<string>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Microsoft.DotNet.Cli.Commands.Tool.List.ToolListJsonContract),
                Converter = null,
                Getter = static obj => ((global::Microsoft.DotNet.Cli.Commands.Tool.List.ToolListJsonContract)obj).PackageId,
                Setter = static (obj, value) => __set_ToolListJsonContract_PackageId((global::Microsoft.DotNet.Cli.Commands.Tool.List.ToolListJsonContract)obj, value!),
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "PackageId",
                JsonPropertyName = "packageId",
                AttributeProviderFactory = static () => typeof(global::Microsoft.DotNet.Cli.Commands.Tool.List.ToolListJsonContract).GetProperty("PackageId", 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].IsRequired = true;

            var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Microsoft.DotNet.Cli.Commands.Tool.List.ToolListJsonContract),
                Converter = null,
                Getter = static obj => ((global::Microsoft.DotNet.Cli.Commands.Tool.List.ToolListJsonContract)obj).Version,
                Setter = static (obj, value) => __set_ToolListJsonContract_Version((global::Microsoft.DotNet.Cli.Commands.Tool.List.ToolListJsonContract)obj, value!),
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "Version",
                JsonPropertyName = "version",
                AttributeProviderFactory = static () => typeof(global::Microsoft.DotNet.Cli.Commands.Tool.List.ToolListJsonContract).GetProperty("Version", 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].IsRequired = true;

            var info2 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string[]>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Microsoft.DotNet.Cli.Commands.Tool.List.ToolListJsonContract),
                Converter = null,
                Getter = static obj => ((global::Microsoft.DotNet.Cli.Commands.Tool.List.ToolListJsonContract)obj).Commands,
                Setter = static (obj, value) => __set_ToolListJsonContract_Commands((global::Microsoft.DotNet.Cli.Commands.Tool.List.ToolListJsonContract)obj, value!),
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "Commands",
                JsonPropertyName = "commands",
                AttributeProviderFactory = static () => typeof(global::Microsoft.DotNet.Cli.Commands.Tool.List.ToolListJsonContract).GetProperty("Commands", InstanceMemberBindingFlags, null, typeof(string[]), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[2] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<string[]>(options, info2);
            properties[2].IsRequired = true;

            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 ToolListJsonContractSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Microsoft.DotNet.Cli.Commands.Tool.List.ToolListJsonContract? value)
        {
            if (value is null)
            {
                writer.WriteNullValue();
                return;
            }
            
            writer.WriteStartObject();

            writer.WriteString(PropName_packageId, ((global::Microsoft.DotNet.Cli.Commands.Tool.List.ToolListJsonContract)value).PackageId);
            writer.WriteString(PropName_version, ((global::Microsoft.DotNet.Cli.Commands.Tool.List.ToolListJsonContract)value).Version);
            writer.WritePropertyName(PropName_commands);
            StringArraySerializeHandler(writer, ((global::Microsoft.DotNet.Cli.Commands.Tool.List.ToolListJsonContract)value).Commands);

            writer.WriteEndObject();
        }

        private static global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[] ToolListJsonContractCtorParamInit() => new global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[]
        {
            new()
            {
                Name = "PackageId",
                ParameterType = typeof(string),
                Position = 0,
                IsNullable = true,
                IsMemberInitializer = true,
            },

            new()
            {
                Name = "Version",
                ParameterType = typeof(string),
                Position = 1,
                IsNullable = true,
                IsMemberInitializer = true,
            },

            new()
            {
                Name = "Commands",
                ParameterType = typeof(string[]),
                Position = 2,
                IsNullable = true,
                IsMemberInitializer = true,
            },
        };

        [global::System.Runtime.CompilerServices.UnsafeAccessorAttribute(global::System.Runtime.CompilerServices.UnsafeAccessorKind.Method, Name = "set_PackageId")]
        private static extern void __set_ToolListJsonContract_PackageId(global::Microsoft.DotNet.Cli.Commands.Tool.List.ToolListJsonContract obj, string value);
        [global::System.Runtime.CompilerServices.UnsafeAccessorAttribute(global::System.Runtime.CompilerServices.UnsafeAccessorKind.Method, Name = "set_Version")]
        private static extern void __set_ToolListJsonContract_Version(global::Microsoft.DotNet.Cli.Commands.Tool.List.ToolListJsonContract obj, string value);
        [global::System.Runtime.CompilerServices.UnsafeAccessorAttribute(global::System.Runtime.CompilerServices.UnsafeAccessorKind.Method, Name = "set_Commands")]
        private static extern void __set_ToolListJsonContract_Commands(global::Microsoft.DotNet.Cli.Commands.Tool.List.ToolListJsonContract obj, string[] value);
    }
}