|
// <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.Core.PackageIdentity>? _PackageIdentity;
/// <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.Core.PackageIdentity> PackageIdentity
#nullable enable annotations
{
get => _PackageIdentity ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::NuGet.Packaging.Core.PackageIdentity>)Options.GetTypeInfo(typeof(global::NuGet.Packaging.Core.PackageIdentity));
}
private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::NuGet.Packaging.Core.PackageIdentity> Create_PackageIdentity(global::System.Text.Json.JsonSerializerOptions options)
{
if (!TryGetTypeInfoForRuntimeCustomConverter<global::NuGet.Packaging.Core.PackageIdentity>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::NuGet.Packaging.Core.PackageIdentity> jsonTypeInfo))
{
var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::NuGet.Packaging.Core.PackageIdentity>
{
ObjectCreator = null,
ObjectWithParameterizedConstructorCreator = static args => new global::NuGet.Packaging.Core.PackageIdentity((string)args[0], (global::NuGet.Versioning.NuGetVersion)args[1]),
PropertyMetadataInitializer = _ => PackageIdentityPropInit(options),
ConstructorParameterMetadataInitializer = PackageIdentityCtorParamInit,
ConstructorAttributeProviderFactory = static () => typeof(global::NuGet.Packaging.Core.PackageIdentity).GetConstructor(InstanceMemberBindingFlags, binder: null, new[] {typeof(string), typeof(global::NuGet.Versioning.NuGetVersion)}, modifiers: null),
SerializeHandler = PackageIdentitySerializeHandler,
};
jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::NuGet.Packaging.Core.PackageIdentity>(options, objectInfo);
jsonTypeInfo.NumberHandling = null;
}
jsonTypeInfo.OriginatingResolver = this;
return jsonTypeInfo;
}
private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] PackageIdentityPropInit(global::System.Text.Json.JsonSerializerOptions options)
{
var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[3];
var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string>
{
IsProperty = true,
IsPublic = true,
IsVirtual = false,
DeclaringType = typeof(global::NuGet.Packaging.Core.PackageIdentity),
Converter = null,
Getter = static obj => ((global::NuGet.Packaging.Core.PackageIdentity)obj).Id,
Setter = null,
IgnoreCondition = null,
HasJsonInclude = false,
IsExtensionData = false,
NumberHandling = null,
PropertyName = "Id",
JsonPropertyName = null,
AttributeProviderFactory = static () => typeof(global::NuGet.Packaging.Core.PackageIdentity).GetProperty("Id", 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);
properties[0].IsGetNullable = false;
var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<global::NuGet.Versioning.NuGetVersion>
{
IsProperty = true,
IsPublic = true,
IsVirtual = false,
DeclaringType = typeof(global::NuGet.Packaging.Core.PackageIdentity),
Converter = null,
Getter = static obj => ((global::NuGet.Packaging.Core.PackageIdentity)obj).Version,
Setter = null,
IgnoreCondition = null,
HasJsonInclude = false,
IsExtensionData = false,
NumberHandling = null,
PropertyName = "Version",
JsonPropertyName = null,
AttributeProviderFactory = static () => typeof(global::NuGet.Packaging.Core.PackageIdentity).GetProperty("Version", InstanceMemberBindingFlags, null, typeof(global::NuGet.Versioning.NuGetVersion), global::System.Array.Empty<global::System.Type>(), null),
};
properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::NuGet.Versioning.NuGetVersion>(options, info1);
properties[1].IsGetNullable = false;
var info2 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<bool>
{
IsProperty = true,
IsPublic = true,
IsVirtual = false,
DeclaringType = typeof(global::NuGet.Packaging.Core.PackageIdentity),
Converter = null,
Getter = static obj => ((global::NuGet.Packaging.Core.PackageIdentity)obj).HasVersion,
Setter = null,
IgnoreCondition = null,
HasJsonInclude = false,
IsExtensionData = false,
NumberHandling = null,
PropertyName = "HasVersion",
JsonPropertyName = null,
AttributeProviderFactory = static () => typeof(global::NuGet.Packaging.Core.PackageIdentity).GetProperty("HasVersion", InstanceMemberBindingFlags, null, typeof(bool), global::System.Array.Empty<global::System.Type>(), null),
};
properties[2] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<bool>(options, info2);
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 PackageIdentitySerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::NuGet.Packaging.Core.PackageIdentity? value)
{
if (value is null)
{
writer.WriteNullValue();
return;
}
writer.WriteStartObject();
writer.WriteString(PropName_Id, ((global::NuGet.Packaging.Core.PackageIdentity)value).Id);
writer.WritePropertyName(PropName_Version);
NuGetVersionSerializeHandler(writer, ((global::NuGet.Packaging.Core.PackageIdentity)value).Version);
writer.WriteBoolean(PropName_HasVersion, ((global::NuGet.Packaging.Core.PackageIdentity)value).HasVersion);
writer.WriteEndObject();
}
private static global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[] PackageIdentityCtorParamInit() => new global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[]
{
new()
{
Name = "id",
ParameterType = typeof(string),
Position = 0,
HasDefaultValue = false,
DefaultValue = null,
IsNullable = false,
},
new()
{
Name = "version",
ParameterType = typeof(global::NuGet.Versioning.NuGetVersion),
Position = 1,
HasDefaultValue = false,
DefaultValue = null,
IsNullable = true,
},
};
}
}
|