File: _generated\27\TemplateCacheJsonSerializerContext.TemplateParameterPrecedence.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.TemplateParameterPrecedence>? _TemplateParameterPrecedence;
        
        /// <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.TemplateParameterPrecedence> TemplateParameterPrecedence
        #nullable enable annotations
        {
            get => _TemplateParameterPrecedence ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.TemplateEngine.Abstractions.TemplateParameterPrecedence>)Options.GetTypeInfo(typeof(global::Microsoft.TemplateEngine.Abstractions.TemplateParameterPrecedence));
        }
        
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.TemplateEngine.Abstractions.TemplateParameterPrecedence> Create_TemplateParameterPrecedence(global::System.Text.Json.JsonSerializerOptions options)
        {
            if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.TemplateEngine.Abstractions.TemplateParameterPrecedence>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.TemplateEngine.Abstractions.TemplateParameterPrecedence> jsonTypeInfo))
            {
                var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Microsoft.TemplateEngine.Abstractions.TemplateParameterPrecedence>
                {
                    ObjectCreator = null,
                    ObjectWithParameterizedConstructorCreator = static args => new global::Microsoft.TemplateEngine.Abstractions.TemplateParameterPrecedence((global::Microsoft.TemplateEngine.Abstractions.PrecedenceDefinition)args[0], (string)args[1], (string)args[2], (bool)args[3]),
                    PropertyMetadataInitializer = _ => TemplateParameterPrecedencePropInit(options),
                    ConstructorParameterMetadataInitializer = TemplateParameterPrecedenceCtorParamInit,
                    ConstructorAttributeProviderFactory = static () => typeof(global::Microsoft.TemplateEngine.Abstractions.TemplateParameterPrecedence).GetConstructor(InstanceMemberBindingFlags, binder: null, new[] {typeof(global::Microsoft.TemplateEngine.Abstractions.PrecedenceDefinition), typeof(string), typeof(string), typeof(bool)}, modifiers: null),
                    SerializeHandler = TemplateParameterPrecedenceSerializeHandler,
                };
                
                jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Microsoft.TemplateEngine.Abstractions.TemplateParameterPrecedence>(options, objectInfo);
                jsonTypeInfo.NumberHandling = null;
            }
        
            jsonTypeInfo.OriginatingResolver = this;
            return jsonTypeInfo;
        }

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

            var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<global::Microsoft.TemplateEngine.Abstractions.PrecedenceDefinition>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Microsoft.TemplateEngine.Abstractions.TemplateParameterPrecedence),
                Converter = null,
                Getter = static obj => ((global::Microsoft.TemplateEngine.Abstractions.TemplateParameterPrecedence)obj).PrecedenceDefinition,
                Setter = null,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "PrecedenceDefinition",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::Microsoft.TemplateEngine.Abstractions.TemplateParameterPrecedence).GetProperty("PrecedenceDefinition", InstanceMemberBindingFlags, null, typeof(global::Microsoft.TemplateEngine.Abstractions.PrecedenceDefinition), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::Microsoft.TemplateEngine.Abstractions.PrecedenceDefinition>(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.TemplateParameterPrecedence),
                Converter = null,
                Getter = static obj => ((global::Microsoft.TemplateEngine.Abstractions.TemplateParameterPrecedence)obj).IsRequiredCondition,
                Setter = null,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "IsRequiredCondition",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::Microsoft.TemplateEngine.Abstractions.TemplateParameterPrecedence).GetProperty("IsRequiredCondition", 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);

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

            var info3 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<bool>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Microsoft.TemplateEngine.Abstractions.TemplateParameterPrecedence),
                Converter = null,
                Getter = static obj => ((global::Microsoft.TemplateEngine.Abstractions.TemplateParameterPrecedence)obj).IsRequired,
                Setter = null,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "IsRequired",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::Microsoft.TemplateEngine.Abstractions.TemplateParameterPrecedence).GetProperty("IsRequired", InstanceMemberBindingFlags, null, typeof(bool), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[3] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<bool>(options, info3);

            var info4 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<bool>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Microsoft.TemplateEngine.Abstractions.TemplateParameterPrecedence),
                Converter = null,
                Getter = static obj => ((global::Microsoft.TemplateEngine.Abstractions.TemplateParameterPrecedence)obj).CanBeRequired,
                Setter = null,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "CanBeRequired",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::Microsoft.TemplateEngine.Abstractions.TemplateParameterPrecedence).GetProperty("CanBeRequired", InstanceMemberBindingFlags, null, typeof(bool), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[4] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<bool>(options, info4);

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

            writer.WritePropertyName(PropName_PrecedenceDefinition);
            global::System.Text.Json.JsonSerializer.Serialize(writer, ((global::Microsoft.TemplateEngine.Abstractions.TemplateParameterPrecedence)value).PrecedenceDefinition, PrecedenceDefinition);
            string __value_IsRequiredCondition = ((global::Microsoft.TemplateEngine.Abstractions.TemplateParameterPrecedence)value).IsRequiredCondition;
            if (__value_IsRequiredCondition is not null)
            {
                writer.WriteString(PropName_IsRequiredCondition, __value_IsRequiredCondition);
            }
            string __value_IsEnabledCondition = ((global::Microsoft.TemplateEngine.Abstractions.TemplateParameterPrecedence)value).IsEnabledCondition;
            if (__value_IsEnabledCondition is not null)
            {
                writer.WriteString(PropName_IsEnabledCondition, __value_IsEnabledCondition);
            }
            writer.WriteBoolean(PropName_IsRequired, ((global::Microsoft.TemplateEngine.Abstractions.TemplateParameterPrecedence)value).IsRequired);
            writer.WriteBoolean(PropName_CanBeRequired, ((global::Microsoft.TemplateEngine.Abstractions.TemplateParameterPrecedence)value).CanBeRequired);

            writer.WriteEndObject();
        }

        private static global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[] TemplateParameterPrecedenceCtorParamInit() => new global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[]
        {
            new()
            {
                Name = "precedenceDefinition",
                ParameterType = typeof(global::Microsoft.TemplateEngine.Abstractions.PrecedenceDefinition),
                Position = 0,
                HasDefaultValue = false,
                DefaultValue = null,
                IsNullable = false,
            },

            new()
            {
                Name = "isRequiredCondition",
                ParameterType = typeof(string),
                Position = 1,
                HasDefaultValue = true,
                DefaultValue = default(string),
                IsNullable = true,
            },

            new()
            {
                Name = "isEnabledCondition",
                ParameterType = typeof(string),
                Position = 2,
                HasDefaultValue = true,
                DefaultValue = default(string),
                IsNullable = true,
            },

            new()
            {
                Name = "isRequired",
                ParameterType = typeof(bool),
                Position = 3,
                HasDefaultValue = true,
                DefaultValue = false,
                IsNullable = false,
            },
        };
    }
}