File: _generated\24\TemplateCacheJsonSerializerContext.ParameterChoice.g.cs
Web Access
Project: src\src\sdk\src\TemplateEngine\Microsoft.TemplateEngine.Edge\Microsoft.TemplateEngine.Edge.csproj (Microsoft.TemplateEngine.Edge)
// <auto-generated/>

#nullable enable annotations
#nullable disable warnings

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

namespace Microsoft.TemplateEngine.Edge.Settings
{
    internal partial class TemplateCacheJsonSerializerContext
    {
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.TemplateEngine.Abstractions.ParameterChoice>? _ParameterChoice;
        
        /// <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.TemplateEngine.Abstractions.ParameterChoice> ParameterChoice
        #nullable enable annotations
        {
            get => _ParameterChoice ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.TemplateEngine.Abstractions.ParameterChoice>)Options.GetTypeInfo(typeof(global::Microsoft.TemplateEngine.Abstractions.ParameterChoice));
        }
        
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.TemplateEngine.Abstractions.ParameterChoice> Create_ParameterChoice(global::System.Text.Json.JsonSerializerOptions options)
        {
            if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.TemplateEngine.Abstractions.ParameterChoice>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.TemplateEngine.Abstractions.ParameterChoice> jsonTypeInfo))
            {
                var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Microsoft.TemplateEngine.Abstractions.ParameterChoice>
                {
                    ObjectCreator = null,
                    ObjectWithParameterizedConstructorCreator = static args => new global::Microsoft.TemplateEngine.Abstractions.ParameterChoice((string)args[0], (string)args[1]),
                    PropertyMetadataInitializer = _ => ParameterChoicePropInit(options),
                    ConstructorParameterMetadataInitializer = ParameterChoiceCtorParamInit,
                    ConstructorAttributeProviderFactory = static () => typeof(global::Microsoft.TemplateEngine.Abstractions.ParameterChoice).GetConstructor(InstanceMemberBindingFlags, binder: null, new[] {typeof(string), typeof(string)}, modifiers: null),
                    SerializeHandler = ParameterChoiceSerializeHandler,
                };
                
                jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Microsoft.TemplateEngine.Abstractions.ParameterChoice>(options, objectInfo);
                jsonTypeInfo.NumberHandling = null;
            }
        
            jsonTypeInfo.OriginatingResolver = this;
            return jsonTypeInfo;
        }

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

            var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Microsoft.TemplateEngine.Abstractions.ParameterChoice),
                Converter = null,
                Getter = static obj => ((global::Microsoft.TemplateEngine.Abstractions.ParameterChoice)obj).DisplayName,
                Setter = static (obj, value) => ((global::Microsoft.TemplateEngine.Abstractions.ParameterChoice)obj).DisplayName = value!,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "DisplayName",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::Microsoft.TemplateEngine.Abstractions.ParameterChoice).GetProperty("DisplayName", 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);

            var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Microsoft.TemplateEngine.Abstractions.ParameterChoice),
                Converter = null,
                Getter = static obj => ((global::Microsoft.TemplateEngine.Abstractions.ParameterChoice)obj).Description,
                Setter = static (obj, value) => ((global::Microsoft.TemplateEngine.Abstractions.ParameterChoice)obj).Description = value!,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "Description",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::Microsoft.TemplateEngine.Abstractions.ParameterChoice).GetProperty("Description", 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);

            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 ParameterChoiceSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Microsoft.TemplateEngine.Abstractions.ParameterChoice? value)
        {
            if (value is null)
            {
                writer.WriteNullValue();
                return;
            }
            
            writer.WriteStartObject();

            string __value_DisplayName = ((global::Microsoft.TemplateEngine.Abstractions.ParameterChoice)value).DisplayName;
            if (__value_DisplayName is not null)
            {
                writer.WriteString(PropName_DisplayName, __value_DisplayName);
            }
            string __value_Description = ((global::Microsoft.TemplateEngine.Abstractions.ParameterChoice)value).Description;
            if (__value_Description is not null)
            {
                writer.WriteString(PropName_Description, __value_Description);
            }

            writer.WriteEndObject();
        }

        private static global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[] ParameterChoiceCtorParamInit() => new global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[]
        {
            new()
            {
                Name = "displayName",
                ParameterType = typeof(string),
                Position = 0,
                HasDefaultValue = false,
                DefaultValue = null,
                IsNullable = true,
            },

            new()
            {
                Name = "description",
                ParameterType = typeof(string),
                Position = 1,
                HasDefaultValue = false,
                DefaultValue = null,
                IsNullable = true,
            },
        };
    }
}