File: _generated\10\PackageSearchJsonContext.NuGetLicenseExpression.g.cs
Web Access
Project: src\src\nuget-client\src\NuGet.Core\NuGet.CommandLine.XPlat\NuGet.CommandLine.XPlat.csproj (NuGet.CommandLine.XPlat)
// <auto-generated/>

#nullable enable annotations
#nullable disable warnings

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

namespace NuGet.CommandLine.XPlat
{
    internal partial class PackageSearchJsonContext
    {
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::NuGet.Packaging.Licenses.NuGetLicenseExpression>? _NuGetLicenseExpression;
        
        /// <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::NuGet.Packaging.Licenses.NuGetLicenseExpression> NuGetLicenseExpression
        #nullable enable annotations
        {
            get => _NuGetLicenseExpression ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::NuGet.Packaging.Licenses.NuGetLicenseExpression>)Options.GetTypeInfo(typeof(global::NuGet.Packaging.Licenses.NuGetLicenseExpression));
        }
        
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::NuGet.Packaging.Licenses.NuGetLicenseExpression> Create_NuGetLicenseExpression(global::System.Text.Json.JsonSerializerOptions options)
        {
            if (!TryGetTypeInfoForRuntimeCustomConverter<global::NuGet.Packaging.Licenses.NuGetLicenseExpression>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::NuGet.Packaging.Licenses.NuGetLicenseExpression> jsonTypeInfo))
            {
                var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::NuGet.Packaging.Licenses.NuGetLicenseExpression>
                {
                    ObjectCreator = null,
                    ObjectWithParameterizedConstructorCreator = null,
                    PropertyMetadataInitializer = _ => NuGetLicenseExpressionPropInit(options),
                    ConstructorParameterMetadataInitializer = null,
                    ConstructorAttributeProviderFactory = null,
                    SerializeHandler = NuGetLicenseExpressionSerializeHandler,
                };
                
                jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::NuGet.Packaging.Licenses.NuGetLicenseExpression>(options, objectInfo);
                jsonTypeInfo.NumberHandling = null;
            }
        
            jsonTypeInfo.OriginatingResolver = this;
            return jsonTypeInfo;
        }

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

            var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<global::NuGet.Packaging.Licenses.LicenseExpressionType>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::NuGet.Packaging.Licenses.NuGetLicenseExpression),
                Converter = null,
                Getter = static obj => ((global::NuGet.Packaging.Licenses.NuGetLicenseExpression)obj).Type,
                Setter = null,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "Type",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::NuGet.Packaging.Licenses.NuGetLicenseExpression).GetProperty("Type", InstanceMemberBindingFlags, null, typeof(global::NuGet.Packaging.Licenses.LicenseExpressionType), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::NuGet.Packaging.Licenses.LicenseExpressionType>(options, info0);

            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 NuGetLicenseExpressionSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::NuGet.Packaging.Licenses.NuGetLicenseExpression? value)
        {
            if (value is null)
            {
                writer.WriteNullValue();
                return;
            }
            
            writer.WriteStartObject();

            writer.WritePropertyName(PropName_Type);
            global::System.Text.Json.JsonSerializer.Serialize(writer, ((global::NuGet.Packaging.Licenses.NuGetLicenseExpression)value).Type, LicenseExpressionType);

            writer.WriteEndObject();
        }
    }
}