Class HumlNamingPolicy
- Namespace
- Huml.Net.Serialization
- Assembly
- Huml.Net.dll
Determines the naming policy used to convert a .NET property name to a HUML key during serialisation and deserialisation.
public abstract class HumlNamingPolicy
- Inheritance
-
HumlNamingPolicy
- Inherited Members
Remarks
Use KebabCase for HUML documents that use kebab-case keys
(the most common HUML convention). When null is used as the policy in
HumlOptions.PropertyNamingPolicy, the .NET property name
is used as-is (ordinal-exact, PascalCase by default in C#). A
HumlPropertyAttribute name override always takes precedence over this policy.
Constructors
HumlNamingPolicy()
Initialises a new instance of HumlNamingPolicy.
protected HumlNamingPolicy()
Properties
CamelCase
Gets the naming policy that converts PascalCase names to camelCase:
FullName → fullName.
public static HumlNamingPolicy CamelCase { get; }
Property Value
KebabCase
Gets the naming policy that converts PascalCase names to kebab-case:
FullName → full-name.
public static HumlNamingPolicy KebabCase { get; }
Property Value
Remarks
Acronyms split letter-by-letter: URL → u-r-l.
Digits are treated as word boundaries: B2B → b-2-b,
Version2Name → version-2-name.
For acronym-aware conversion, use HumlPropertyAttribute directly.
PascalCase
Gets the naming policy that ensures the first character is uppercase:
fullName → FullName.
public static HumlNamingPolicy PascalCase { get; }
Property Value
SnakeCase
Gets the naming policy that converts PascalCase names to snake_case:
FullName → full_name.
public static HumlNamingPolicy SnakeCase { get; }
Property Value
Remarks
Acronyms split letter-by-letter: URL → u_r_l.
Digits are treated as word boundaries: B2B → b_2_b,
Version2Name → version_2_name.
Methods
ConvertName(string)
When overridden in a derived class, converts the specified .NET property name according to the policy.
public abstract string ConvertName(string name)
Parameters
namestringThe .NET property name to convert.
Returns
- string
The converted HUML key name.
Equals(object?)
Determines whether the specified object is equal to the current object.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current object.
Returns
Remarks
Two HumlNamingPolicy instances of the same concrete type are considered equal. This ensures that custom stateless policy subclasses stored as separate instances still share a single Huml.Net.Serialization.PropertyDescriptor cache entry rather than producing unbounded cache growth. Override in a derived class if instance identity is required.
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.