File: BackchannelJsonSerializerContext.RuntimeSpec.g.cs
Project: src\src\Aspire.Cli\Aspire.Cli.Tool.csproj (aspire)
// <auto-generated/>
 
#nullable enable annotations
#nullable disable warnings
 
// Suppress warnings about [Obsolete] member usage in generated code.
#pragma warning disable CS0612, CS0618
 
namespace Aspire.Cli.Backchannel
{
    internal partial class BackchannelJsonSerializerContext
    {
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Aspire.Hosting.Ats.RuntimeSpec>? _RuntimeSpec;
        
        /// <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::Aspire.Hosting.Ats.RuntimeSpec> RuntimeSpec
        #nullable enable annotations
        {
            get => _RuntimeSpec ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Aspire.Hosting.Ats.RuntimeSpec>)Options.GetTypeInfo(typeof(global::Aspire.Hosting.Ats.RuntimeSpec));
        }
        
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Aspire.Hosting.Ats.RuntimeSpec> Create_RuntimeSpec(global::System.Text.Json.JsonSerializerOptions options)
        {
            if (!TryGetTypeInfoForRuntimeCustomConverter<global::Aspire.Hosting.Ats.RuntimeSpec>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Aspire.Hosting.Ats.RuntimeSpec> jsonTypeInfo))
            {
                var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Aspire.Hosting.Ats.RuntimeSpec>
                {
                    ObjectCreator = null,
                    ObjectWithParameterizedConstructorCreator = static args => new global::Aspire.Hosting.Ats.RuntimeSpec(){ Language = (string)args[0], DisplayName = (string)args[1], CodeGenLanguage = (string)args[2], DetectionPatterns = (string[])args[3], InstallDependencies = (global::Aspire.Hosting.Ats.CommandSpec)args[4], Execute = (global::Aspire.Hosting.Ats.CommandSpec)args[5], WatchExecute = (global::Aspire.Hosting.Ats.CommandSpec)args[6], PublishExecute = (global::Aspire.Hosting.Ats.CommandSpec)args[7] },
                    PropertyMetadataInitializer = _ => RuntimeSpecPropInit(options),
                    ConstructorParameterMetadataInitializer = RuntimeSpecCtorParamInit,
                    ConstructorAttributeProviderFactory = static () => typeof(global::Aspire.Hosting.Ats.RuntimeSpec).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty<global::System.Type>(), modifiers: null),
                    SerializeHandler = RuntimeSpecSerializeHandler,
                };
                
                jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Aspire.Hosting.Ats.RuntimeSpec>(options, objectInfo);
                jsonTypeInfo.NumberHandling = null;
            }
        
            jsonTypeInfo.OriginatingResolver = this;
            return jsonTypeInfo;
        }
 
        private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] RuntimeSpecPropInit(global::System.Text.Json.JsonSerializerOptions options)
        {
            var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[8];
 
            var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Aspire.Hosting.Ats.RuntimeSpec),
                Converter = null,
                Getter = static obj => ((global::Aspire.Hosting.Ats.RuntimeSpec)obj).Language,
                Setter = static (obj, value) => throw new global::System.InvalidOperationException("Setting init-only properties is not supported in source generation mode."),
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "Language",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::Aspire.Hosting.Ats.RuntimeSpec).GetProperty("Language", 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;
            properties[0].IsGetNullable = false;
            properties[0].IsSetNullable = false;
 
            var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Aspire.Hosting.Ats.RuntimeSpec),
                Converter = null,
                Getter = static obj => ((global::Aspire.Hosting.Ats.RuntimeSpec)obj).DisplayName,
                Setter = static (obj, value) => throw new global::System.InvalidOperationException("Setting init-only properties is not supported in source generation mode."),
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "DisplayName",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::Aspire.Hosting.Ats.RuntimeSpec).GetProperty("DisplayName", 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;
            properties[1].IsGetNullable = false;
            properties[1].IsSetNullable = false;
 
            var info2 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Aspire.Hosting.Ats.RuntimeSpec),
                Converter = null,
                Getter = static obj => ((global::Aspire.Hosting.Ats.RuntimeSpec)obj).CodeGenLanguage,
                Setter = static (obj, value) => throw new global::System.InvalidOperationException("Setting init-only properties is not supported in source generation mode."),
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "CodeGenLanguage",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::Aspire.Hosting.Ats.RuntimeSpec).GetProperty("CodeGenLanguage", 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;
            properties[2].IsGetNullable = false;
            properties[2].IsSetNullable = false;
 
            var info3 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string[]>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Aspire.Hosting.Ats.RuntimeSpec),
                Converter = null,
                Getter = static obj => ((global::Aspire.Hosting.Ats.RuntimeSpec)obj).DetectionPatterns,
                Setter = static (obj, value) => throw new global::System.InvalidOperationException("Setting init-only properties is not supported in source generation mode."),
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "DetectionPatterns",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::Aspire.Hosting.Ats.RuntimeSpec).GetProperty("DetectionPatterns", 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;
            properties[3].IsGetNullable = false;
            properties[3].IsSetNullable = false;
 
            var info4 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<global::Aspire.Hosting.Ats.CommandSpec>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Aspire.Hosting.Ats.RuntimeSpec),
                Converter = null,
                Getter = static obj => ((global::Aspire.Hosting.Ats.RuntimeSpec)obj).InstallDependencies,
                Setter = static (obj, value) => throw new global::System.InvalidOperationException("Setting init-only properties is not supported in source generation mode."),
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "InstallDependencies",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::Aspire.Hosting.Ats.RuntimeSpec).GetProperty("InstallDependencies", InstanceMemberBindingFlags, null, typeof(global::Aspire.Hosting.Ats.CommandSpec), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[4] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::Aspire.Hosting.Ats.CommandSpec>(options, info4);
 
            var info5 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<global::Aspire.Hosting.Ats.CommandSpec>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Aspire.Hosting.Ats.RuntimeSpec),
                Converter = null,
                Getter = static obj => ((global::Aspire.Hosting.Ats.RuntimeSpec)obj).Execute,
                Setter = static (obj, value) => throw new global::System.InvalidOperationException("Setting init-only properties is not supported in source generation mode."),
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "Execute",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::Aspire.Hosting.Ats.RuntimeSpec).GetProperty("Execute", InstanceMemberBindingFlags, null, typeof(global::Aspire.Hosting.Ats.CommandSpec), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[5] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::Aspire.Hosting.Ats.CommandSpec>(options, info5);
            properties[5].IsRequired = true;
            properties[5].IsGetNullable = false;
            properties[5].IsSetNullable = false;
 
            var info6 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<global::Aspire.Hosting.Ats.CommandSpec>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Aspire.Hosting.Ats.RuntimeSpec),
                Converter = null,
                Getter = static obj => ((global::Aspire.Hosting.Ats.RuntimeSpec)obj).WatchExecute,
                Setter = static (obj, value) => throw new global::System.InvalidOperationException("Setting init-only properties is not supported in source generation mode."),
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "WatchExecute",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::Aspire.Hosting.Ats.RuntimeSpec).GetProperty("WatchExecute", InstanceMemberBindingFlags, null, typeof(global::Aspire.Hosting.Ats.CommandSpec), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[6] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::Aspire.Hosting.Ats.CommandSpec>(options, info6);
 
            var info7 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<global::Aspire.Hosting.Ats.CommandSpec>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Aspire.Hosting.Ats.RuntimeSpec),
                Converter = null,
                Getter = static obj => ((global::Aspire.Hosting.Ats.RuntimeSpec)obj).PublishExecute,
                Setter = static (obj, value) => throw new global::System.InvalidOperationException("Setting init-only properties is not supported in source generation mode."),
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "PublishExecute",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::Aspire.Hosting.Ats.RuntimeSpec).GetProperty("PublishExecute", InstanceMemberBindingFlags, null, typeof(global::Aspire.Hosting.Ats.CommandSpec), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[7] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::Aspire.Hosting.Ats.CommandSpec>(options, info7);
 
            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 RuntimeSpecSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Aspire.Hosting.Ats.RuntimeSpec? value)
        {
            if (value is null)
            {
                writer.WriteNullValue();
                return;
            }
            
            writer.WriteStartObject();
 
            writer.WriteString(PropName_Language, ((global::Aspire.Hosting.Ats.RuntimeSpec)value).Language);
            writer.WriteString(PropName_DisplayName, ((global::Aspire.Hosting.Ats.RuntimeSpec)value).DisplayName);
            writer.WriteString(PropName_CodeGenLanguage, ((global::Aspire.Hosting.Ats.RuntimeSpec)value).CodeGenLanguage);
            writer.WritePropertyName(PropName_DetectionPatterns);
            StringArraySerializeHandler(writer, ((global::Aspire.Hosting.Ats.RuntimeSpec)value).DetectionPatterns);
            writer.WritePropertyName(PropName_InstallDependencies);
            CommandSpecSerializeHandler(writer, ((global::Aspire.Hosting.Ats.RuntimeSpec)value).InstallDependencies);
            writer.WritePropertyName(PropName_Execute);
            CommandSpecSerializeHandler(writer, ((global::Aspire.Hosting.Ats.RuntimeSpec)value).Execute);
            writer.WritePropertyName(PropName_WatchExecute);
            CommandSpecSerializeHandler(writer, ((global::Aspire.Hosting.Ats.RuntimeSpec)value).WatchExecute);
            writer.WritePropertyName(PropName_PublishExecute);
            CommandSpecSerializeHandler(writer, ((global::Aspire.Hosting.Ats.RuntimeSpec)value).PublishExecute);
 
            writer.WriteEndObject();
        }
 
        private static global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[] RuntimeSpecCtorParamInit() => new global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[]
        {
            new()
            {
                Name = "Language",
                ParameterType = typeof(string),
                Position = 0,
                IsNullable = false,
                IsMemberInitializer = true,
            },
 
            new()
            {
                Name = "DisplayName",
                ParameterType = typeof(string),
                Position = 1,
                IsNullable = false,
                IsMemberInitializer = true,
            },
 
            new()
            {
                Name = "CodeGenLanguage",
                ParameterType = typeof(string),
                Position = 2,
                IsNullable = false,
                IsMemberInitializer = true,
            },
 
            new()
            {
                Name = "DetectionPatterns",
                ParameterType = typeof(string[]),
                Position = 3,
                IsNullable = false,
                IsMemberInitializer = true,
            },
 
            new()
            {
                Name = "InstallDependencies",
                ParameterType = typeof(global::Aspire.Hosting.Ats.CommandSpec),
                Position = 4,
                IsNullable = true,
                IsMemberInitializer = true,
            },
 
            new()
            {
                Name = "Execute",
                ParameterType = typeof(global::Aspire.Hosting.Ats.CommandSpec),
                Position = 5,
                IsNullable = false,
                IsMemberInitializer = true,
            },
 
            new()
            {
                Name = "WatchExecute",
                ParameterType = typeof(global::Aspire.Hosting.Ats.CommandSpec),
                Position = 6,
                IsNullable = true,
                IsMemberInitializer = true,
            },
 
            new()
            {
                Name = "PublishExecute",
                ParameterType = typeof(global::Aspire.Hosting.Ats.CommandSpec),
                Position = 7,
                IsNullable = true,
                IsMemberInitializer = true,
            },
        };
    }
}