File: BackchannelJsonSerializerContext.RequestId.g.cs
Project: src\src\Aspire.Cli\Aspire.Cli.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::StreamJsonRpc.RequestId>? _RequestId;
        
        /// <summary>
        /// Defines the source generated JSON serialization contract metadata for a given type.
        /// </summary>
        public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::StreamJsonRpc.RequestId> RequestId
        {
            get => _RequestId ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::StreamJsonRpc.RequestId>)Options.GetTypeInfo(typeof(global::StreamJsonRpc.RequestId));
        }
        
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::StreamJsonRpc.RequestId> Create_RequestId(global::System.Text.Json.JsonSerializerOptions options)
        {
            if (!TryGetTypeInfoForRuntimeCustomConverter<global::StreamJsonRpc.RequestId>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::StreamJsonRpc.RequestId> jsonTypeInfo))
            {
                var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::StreamJsonRpc.RequestId>
                {
                    ObjectCreator = () => new global::StreamJsonRpc.RequestId(),
                    ObjectWithParameterizedConstructorCreator = null,
                    PropertyMetadataInitializer = _ => RequestIdPropInit(options),
                    ConstructorParameterMetadataInitializer = null,
                    SerializeHandler = RequestIdSerializeHandler
                };
                
                jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::StreamJsonRpc.RequestId>(options, objectInfo);
                jsonTypeInfo.NumberHandling = null;
            }
        
            jsonTypeInfo.OriginatingResolver = this;
            return jsonTypeInfo;
        }
 
        private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] RequestIdPropInit(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<long?>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::StreamJsonRpc.RequestId),
                Converter = null,
                Getter = static obj => ((global::StreamJsonRpc.RequestId)obj).Number,
                Setter = null,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "Number",
                JsonPropertyName = null
            };
            
            properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<long?>(options, info0);
 
            var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::StreamJsonRpc.RequestId),
                Converter = null,
                Getter = static obj => ((global::StreamJsonRpc.RequestId)obj).String,
                Setter = null,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "String",
                JsonPropertyName = null
            };
            
            properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<string>(options, info1);
 
            var info2 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<bool>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::StreamJsonRpc.RequestId),
                Converter = null,
                Getter = static obj => ((global::StreamJsonRpc.RequestId)obj).IsNull,
                Setter = null,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "IsNull",
                JsonPropertyName = null
            };
            
            properties[2] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<bool>(options, info2);
 
            var info3 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<bool>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::StreamJsonRpc.RequestId),
                Converter = null,
                Getter = static obj => ((global::StreamJsonRpc.RequestId)obj).IsEmpty,
                Setter = null,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "IsEmpty",
                JsonPropertyName = null
            };
            
            properties[3] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<bool>(options, info3);
 
            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 RequestIdSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::StreamJsonRpc.RequestId value)
        {
            writer.WriteStartObject();
 
            writer.WritePropertyName(PropName_Number);
            global::System.Text.Json.JsonSerializer.Serialize(writer, ((global::StreamJsonRpc.RequestId)value).Number, NullableInt64);
            writer.WriteString(PropName_String, ((global::StreamJsonRpc.RequestId)value).String);
            writer.WriteBoolean(PropName_IsNull, ((global::StreamJsonRpc.RequestId)value).IsNull);
            writer.WriteBoolean(PropName_IsEmpty, ((global::StreamJsonRpc.RequestId)value).IsEmpty);
 
            writer.WriteEndObject();
        }
    }
}