< Summary

Line coverage
0%
Covered lines: 0
Uncovered lines: 5
Coverable lines: 5
Total lines: 59
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

File(s)

https://raw.githubusercontent.com/dotnet/runtime/811a7eabb75c42db53440e8ba3f60c07511cfd1f/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonUnionInfoValuesOfT.cs

#LineLine coverage
 1// Licensed to the .NET Foundation under one or more agreements.
 2// The .NET Foundation licenses this file to you under the MIT license.
 3
 4using System.Collections.Generic;
 5using System.ComponentModel;
 6
 7namespace System.Text.Json.Serialization.Metadata
 8{
 9    /// <summary>
 10    /// Provides serialization metadata about a union type.
 11    /// </summary>
 12    /// <typeparam name="T">The union type to serialize or deserialize.</typeparam>
 13    /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called dir
 14    [EditorBrowsable(EditorBrowsableState.Never)]
 15    public sealed class JsonUnionInfoValues<T>
 16    {
 17        /// <summary>
 18        /// Gets or sets the list of union case type metadata for the current union type.
 19        /// </summary>
 20        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 021        public IList<JsonUnionCaseInfo>? UnionCases { get; init; }
 22
 23        /// <summary>
 24        /// Gets or sets the delegate used to construct a union instance from a case type and case value.
 25        /// </summary>
 26        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 027        public Func<Type, object?, T>? UnionConstructor { get; init; }
 28
 29        /// <summary>
 30        /// Gets or sets the delegate used to deconstruct a union instance into its case type and case value.
 31        /// </summary>
 32        /// <remarks>
 33        /// This API is for use by the output of the System.Text.Json source generator and should not be called directly
 34        /// Refer to <see cref="JsonTypeInfo.UnionDeconstructor"/> for the full <c>(CaseType, CaseValue)</c>
 35        /// contract — including the role of a <see langword="null"/> <c>CaseType</c> as the
 36        /// discriminator for the canonical null-union state.
 37        /// </remarks>
 038        public Func<T, (Type? CaseType, object? CaseValue)>? UnionDeconstructor { get; init; }
 39
 40        /// <summary>
 41        /// Gets or sets the delegate used to classify JSON payloads during union deserialization.
 42        /// </summary>
 43        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 044        public JsonTypeClassifier? TypeClassifier { get; init; }
 45
 46        /// <summary>
 47        /// Gets or sets a factory used to lazily construct a <see cref="JsonTypeClassifier"/>
 48        /// from the union's metadata at <see cref="JsonTypeInfo"/> configuration time.
 49        /// </summary>
 50        /// <remarks>
 51        /// This API is for use by the output of the System.Text.Json source generator and should not be called directly
 52        /// Resolved from <see cref="JsonUnionAttribute.TypeClassifier"/> at compile time.
 53        /// When both this property and <see cref="TypeClassifier"/> are set, the explicit
 54        /// classifier delegate wins and the factory is ignored.
 55        /// </remarks>
 056        public JsonTypeClassifierFactory? TypeClassifierFactory { get; init; }
 57    }
 58}
 59