| | | 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 | | |
| | | 4 | | using System.ComponentModel; |
| | | 5 | | using System.Reflection; |
| | | 6 | | |
| | | 7 | | namespace System.Text.Json.Serialization.Metadata |
| | | 8 | | { |
| | | 9 | | /// <summary> |
| | | 10 | | /// Provides serialization metadata about a property or field. |
| | | 11 | | /// </summary> |
| | | 12 | | /// <typeparam name="T">The type to convert of the <see cref="JsonConverter{T}"/> for the property.</typeparam> |
| | | 13 | | [EditorBrowsable(EditorBrowsableState.Never)] |
| | | 14 | | public sealed class JsonPropertyInfoValues<T> |
| | | 15 | | { |
| | | 16 | | /// <summary> |
| | | 17 | | /// If <see langword="true"/>, indicates that the member is a property, otherwise indicates the member is a fiel |
| | | 18 | | /// </summary> |
| | 0 | 19 | | public bool IsProperty { get; init; } |
| | | 20 | | |
| | | 21 | | /// <summary> |
| | | 22 | | /// Whether the property or field is public. |
| | | 23 | | /// </summary> |
| | 0 | 24 | | public bool IsPublic { get; init; } |
| | | 25 | | |
| | | 26 | | /// <summary> |
| | | 27 | | /// Whether the property or field is a virtual property. |
| | | 28 | | /// </summary> |
| | 0 | 29 | | public bool IsVirtual { get; init; } |
| | | 30 | | |
| | | 31 | | /// <summary> |
| | | 32 | | /// The declaring type of the property or field. |
| | | 33 | | /// </summary> |
| | 0 | 34 | | public Type DeclaringType { get; init; } = null!; |
| | | 35 | | |
| | | 36 | | /// <summary> |
| | | 37 | | /// The <see cref="JsonTypeInfo"/> info for the property or field's type. |
| | | 38 | | /// </summary> |
| | 0 | 39 | | public JsonTypeInfo PropertyTypeInfo { get; init; } = null!; |
| | | 40 | | |
| | | 41 | | /// <summary> |
| | | 42 | | /// A <see cref="JsonConverter"/> for the property or field, specified by <see cref="JsonConverterAttribute"/>. |
| | | 43 | | /// </summary> |
| | 0 | 44 | | public JsonConverter<T>? Converter { get; init; } |
| | | 45 | | |
| | | 46 | | /// <summary> |
| | | 47 | | /// Provides a mechanism to get the property or field's value. |
| | | 48 | | /// </summary> |
| | 0 | 49 | | public Func<object, T?>? Getter { get; init; } |
| | | 50 | | |
| | | 51 | | /// <summary> |
| | | 52 | | /// Provides a mechanism to set the property or field's value. |
| | | 53 | | /// </summary> |
| | 0 | 54 | | public Action<object, T?>? Setter { get; init; } |
| | | 55 | | |
| | | 56 | | /// <summary> |
| | | 57 | | /// Specifies a condition for the member to be ignored. |
| | | 58 | | /// </summary> |
| | 0 | 59 | | public JsonIgnoreCondition? IgnoreCondition { get; init; } |
| | | 60 | | |
| | | 61 | | /// <summary> |
| | | 62 | | /// Whether the property was annotated with <see cref="JsonIncludeAttribute"/>. |
| | | 63 | | /// </summary> |
| | 0 | 64 | | public bool HasJsonInclude { get; init; } |
| | | 65 | | |
| | | 66 | | /// <summary> |
| | | 67 | | /// Whether the property was annotated with <see cref="JsonExtensionDataAttribute"/>. |
| | | 68 | | /// </summary> |
| | 0 | 69 | | public bool IsExtensionData { get; init; } |
| | | 70 | | |
| | | 71 | | /// <summary> |
| | | 72 | | /// If the property or field is a number, specifies how it should processed when serializing and deserializing. |
| | | 73 | | /// </summary> |
| | 0 | 74 | | public JsonNumberHandling? NumberHandling { get; init; } |
| | | 75 | | |
| | | 76 | | /// <summary> |
| | | 77 | | /// The name of the property or field. |
| | | 78 | | /// </summary> |
| | 0 | 79 | | public string PropertyName { get; init; } = null!; |
| | | 80 | | |
| | | 81 | | /// <summary> |
| | | 82 | | /// The name to be used when processing the property or field, specified by <see cref="JsonPropertyNameAttribute |
| | | 83 | | /// </summary> |
| | 0 | 84 | | public string? JsonPropertyName { get; init; } |
| | | 85 | | |
| | | 86 | | /// <summary> |
| | | 87 | | /// Provides a <see cref="ICustomAttributeProvider"/> factory that maps to <see cref="JsonPropertyInfo.Attribute |
| | | 88 | | /// </summary> |
| | 0 | 89 | | public Func<ICustomAttributeProvider>? AttributeProviderFactory { get; init; } |
| | | 90 | | } |
| | | 91 | | } |