File: _generated\57\ToolListJsonSerializerContext.LocalToolListJsonContract.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.LocalToolListJsonContract>? _LocalToolListJsonContract;
        
        /// <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.LocalToolListJsonContract> LocalToolListJsonContract
        #nullable enable annotations
        {
            get => _LocalToolListJsonContract ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.DotNet.Cli.Commands.Tool.List.LocalToolListJsonContract>)Options.GetTypeInfo(typeof(global::Microsoft.DotNet.Cli.Commands.Tool.List.LocalToolListJsonContract));
        }
        
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.DotNet.Cli.Commands.Tool.List.LocalToolListJsonContract> Create_LocalToolListJsonContract(global::System.Text.Json.JsonSerializerOptions options)
        {
            if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.DotNet.Cli.Commands.Tool.List.LocalToolListJsonContract>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.DotNet.Cli.Commands.Tool.List.LocalToolListJsonContract> jsonTypeInfo))
            {
                var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Microsoft.DotNet.Cli.Commands.Tool.List.LocalToolListJsonContract>
                {
                    ObjectCreator = null,
                    ObjectWithParameterizedConstructorCreator = static args => new global::Microsoft.DotNet.Cli.Commands.Tool.List.LocalToolListJsonContract(){ Manifest = (string)args[0], PackageId = (string)args[1], Version = (string)args[2], Commands = (string[])args[3] },
                    PropertyMetadataInitializer = _ => LocalToolListJsonContractPropInit(options),
                    ConstructorParameterMetadataInitializer = LocalToolListJsonContractCtorParamInit,
                    ConstructorAttributeProviderFactory = static () => typeof(global::Microsoft.DotNet.Cli.Commands.Tool.List.LocalToolListJsonContract).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty<global::System.Type>(), modifiers: null),
                    SerializeHandler = LocalToolListJsonContractSerializeHandler,
                };
                
                jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Microsoft.DotNet.Cli.Commands.Tool.List.LocalToolListJsonContract>(options, objectInfo);
                jsonTypeInfo.NumberHandling = null;
            }
        
            jsonTypeInfo.OriginatingResolver = this;
            return jsonTypeInfo;
        }

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

            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.LocalToolListJsonContract),
                Converter = null,
                Getter = static obj => ((global::Microsoft.DotNet.Cli.Commands.Tool.List.LocalToolListJsonContract)obj).Manifest,
                Setter = static (obj, value) => __set_LocalToolListJsonContract_Manifest((global::Microsoft.DotNet.Cli.Commands.Tool.List.LocalToolListJsonContract)obj, value!),
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "Manifest",
                JsonPropertyName = "manifest",
                AttributeProviderFactory = static () => typeof(global::Microsoft.DotNet.Cli.Commands.Tool.List.LocalToolListJsonContract).GetProperty("Manifest", 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).PackageId,
                Setter = static (obj, value) => __set_LocalToolListJsonContract_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[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).Version,
                Setter = static (obj, value) => __set_LocalToolListJsonContract_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[2] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<string>(options, info2);
            properties[2].IsRequired = true;

            var info3 = 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_LocalToolListJsonContract_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[3] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<string[]>(options, info3);
            properties[3].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 LocalToolListJsonContractSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Microsoft.DotNet.Cli.Commands.Tool.List.LocalToolListJsonContract? value)
        {
            if (value is null)
            {
                writer.WriteNullValue();
                return;
            }
            
            writer.WriteStartObject();

            writer.WriteString(PropName_manifest, ((global::Microsoft.DotNet.Cli.Commands.Tool.List.LocalToolListJsonContract)value).Manifest);
            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[] LocalToolListJsonContractCtorParamInit() => new global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[]
        {
            new()
            {
                Name = "Manifest",
                ParameterType = typeof(string),
                Position = 0,
                IsNullable = true,
                IsMemberInitializer = true,
            },

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

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

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

        [global::System.Runtime.CompilerServices.UnsafeAccessorAttribute(global::System.Runtime.CompilerServices.UnsafeAccessorKind.Method, Name = "set_Manifest")]
        private static extern void __set_LocalToolListJsonContract_Manifest(global::Microsoft.DotNet.Cli.Commands.Tool.List.LocalToolListJsonContract obj, string value);
        [global::System.Runtime.CompilerServices.UnsafeAccessorAttribute(global::System.Runtime.CompilerServices.UnsafeAccessorKind.Method, Name = "set_PackageId")]
        private static extern void __set_LocalToolListJsonContract_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_LocalToolListJsonContract_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_LocalToolListJsonContract_Commands(global::Microsoft.DotNet.Cli.Commands.Tool.List.ToolListJsonContract obj, string[] value);
    }
}