-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Expand file tree
/
Copy pathJsonNamingPolicy.cs
More file actions
53 lines (46 loc) · 1.91 KB
/
Copy pathJsonNamingPolicy.cs
File metadata and controls
53 lines (46 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace System.Text.Json
{
/// <summary>
/// Determines the naming policy used to convert a string-based name to another format, such as a camel-casing format.
/// </summary>
#if BUILDING_SOURCE_GENERATOR
internal
#else
public
#endif
abstract class JsonNamingPolicy
{
/// <summary>
/// Initializes a new instance of <see cref="JsonNamingPolicy"/>.
/// </summary>
protected JsonNamingPolicy() { }
/// <summary>
/// Returns the naming policy for camel-casing.
/// </summary>
public static JsonNamingPolicy CamelCase { get; } = new JsonCamelCaseNamingPolicy();
/// <summary>
/// Returns the naming policy for lower snake-casing.
/// </summary>
public static JsonNamingPolicy SnakeCaseLower { get; } = new JsonSnakeCaseLowerNamingPolicy();
/// <summary>
/// Returns the naming policy for upper snake-casing.
/// </summary>
public static JsonNamingPolicy SnakeCaseUpper { get; } = new JsonSnakeCaseUpperNamingPolicy();
/// <summary>
/// Returns the naming policy for lower kebab-casing.
/// </summary>
public static JsonNamingPolicy KebabCaseLower { get; } = new JsonKebabCaseLowerNamingPolicy();
/// <summary>
/// Returns the naming policy for upper kebab-casing.
/// </summary>
public static JsonNamingPolicy KebabCaseUpper { get; } = new JsonKebabCaseUpperNamingPolicy();
/// <summary>
/// When overridden in a derived class, converts the specified name according to the policy.
/// </summary>
/// <param name="name">The name to convert.</param>
/// <returns>The converted name.</returns>
public abstract string ConvertName(string name);
}
}