Class HumlConverterFactory

Namespace
Huml.Net.Serialization
Assembly
Huml.Net.dll

Abstract base for a HUML converter that produces a different concrete HumlConverter instance per requested type, mirroring System.Text.Json.Serialization.JsonConverterFactory.

public abstract class HumlConverterFactory : HumlConverter
Inheritance
HumlConverterFactory
Inherited Members

Remarks

Use a factory when a single converter implementation needs to serve many concrete CLR types dynamically — e.g. a lenient enum converter usable across an entire schema, or a converter derived via MakeGenericType for a family of generic types. For a single fixed type, prefer HumlConverter<T>.

A factory is never asked to read or write directly — Huml.Net.Serialization.ConverterCache replaces it with the converter returned from CreateConverter(Type, HumlOptions) before dispatch, and the produced converter is cached per requested type. Factories, like all converters, must be stateless.

Methods

CanConvert(Type)

Returns true when this converter can handle typeToConvert.

public override abstract bool CanConvert(Type typeToConvert)

Parameters

typeToConvert Type

The CLR type to evaluate.

Returns

bool

CreateConverter(Type, HumlOptions)

Creates the concrete HumlConverter to use for typeToConvert, or null to decline — resolution then falls through to the next candidate converter or the built-in type dispatch.

public abstract HumlConverter? CreateConverter(Type typeToConvert, HumlOptions options)

Parameters

typeToConvert Type

The CLR type a converter is being resolved for.

options HumlOptions

The active HumlOptions for this resolution.

Returns

HumlConverter