File: AppJsonContext.AppEvent.g.cs
Project: src\playground\nats\Nats.Common\Nats.Common.csproj (Nats.Common)
// <auto-generated/>
 
#nullable enable annotations
#nullable disable warnings
 
// Suppress warnings about [Obsolete] member usage in generated code.
#pragma warning disable CS0612, CS0618
 
namespace Nats.Common
{
    public partial class AppJsonContext
    {
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Nats.Common.AppEvent>? _AppEvent;
        
        /// <summary>
        /// Defines the source generated JSON serialization contract metadata for a given type.
        /// </summary>
        public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Nats.Common.AppEvent> AppEvent
        {
            get => _AppEvent ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Nats.Common.AppEvent>)Options.GetTypeInfo(typeof(global::Nats.Common.AppEvent));
        }
        
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Nats.Common.AppEvent> Create_AppEvent(global::System.Text.Json.JsonSerializerOptions options)
        {
            if (!TryGetTypeInfoForRuntimeCustomConverter<global::Nats.Common.AppEvent>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Nats.Common.AppEvent> jsonTypeInfo))
            {
                var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Nats.Common.AppEvent>
                {
                    ObjectCreator = null,
                    ObjectWithParameterizedConstructorCreator = static args => new global::Nats.Common.AppEvent((string)args[0], (string)args[1], (string)args[2], (decimal)args[3]),
                    PropertyMetadataInitializer = _ => AppEventPropInit(options),
                    ConstructorParameterMetadataInitializer = AppEventCtorParamInit,
                    SerializeHandler = AppEventSerializeHandler
                };
                
                jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Nats.Common.AppEvent>(options, objectInfo);
                jsonTypeInfo.NumberHandling = null;
            }
        
            jsonTypeInfo.OriginatingResolver = this;
            return jsonTypeInfo;
        }
 
        private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] AppEventPropInit(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::Nats.Common.AppEvent),
                Converter = null,
                Getter = static obj => ((global::Nats.Common.AppEvent)obj).Subject,
                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 = "Subject",
                JsonPropertyName = null
            };
            
            properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<string>(options, info0);
 
            var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Nats.Common.AppEvent),
                Converter = null,
                Getter = static obj => ((global::Nats.Common.AppEvent)obj).Name,
                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 = "Name",
                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<string>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Nats.Common.AppEvent),
                Converter = null,
                Getter = static obj => ((global::Nats.Common.AppEvent)obj).Description,
                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 = "Description",
                JsonPropertyName = null
            };
            
            properties[2] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<string>(options, info2);
 
            var info3 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<decimal>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Nats.Common.AppEvent),
                Converter = null,
                Getter = static obj => ((global::Nats.Common.AppEvent)obj).Priority,
                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 = "Priority",
                JsonPropertyName = null
            };
            
            properties[3] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<decimal>(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 AppEventSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Nats.Common.AppEvent? value)
        {
            if (value == null)
            {
                writer.WriteNullValue();
                return;
            }
            
            writer.WriteStartObject();
 
            writer.WriteString(PropName_Subject, ((global::Nats.Common.AppEvent)value).Subject);
            writer.WriteString(PropName_Name, ((global::Nats.Common.AppEvent)value).Name);
            writer.WriteString(PropName_Description, ((global::Nats.Common.AppEvent)value).Description);
            writer.WriteNumber(PropName_Priority, ((global::Nats.Common.AppEvent)value).Priority);
 
            writer.WriteEndObject();
        }
 
        private static global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[] AppEventCtorParamInit()
        {
            var parameters = new global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[4];
 
            parameters[0] = new()
            {
                Name = "Subject",
                ParameterType = typeof(string),
                Position = 0,
                HasDefaultValue = false,
                DefaultValue = default(string)
            };
            
            parameters[1] = new()
            {
                Name = "Name",
                ParameterType = typeof(string),
                Position = 1,
                HasDefaultValue = false,
                DefaultValue = default(string)
            };
            
            parameters[2] = new()
            {
                Name = "Description",
                ParameterType = typeof(string),
                Position = 2,
                HasDefaultValue = false,
                DefaultValue = default(string)
            };
            
            parameters[3] = new()
            {
                Name = "Priority",
                ParameterType = typeof(decimal),
                Position = 3,
                HasDefaultValue = false,
                DefaultValue = default(decimal)
            };
            
            return parameters;
        }
    }
}