ResultConverterRegistry

Holds ResultConverters and finds the one that claims a given value.

Converters are indexed by their supportedSourceClass, and lookup tries the exact class first, then those registered under Any::class, then the parent registry. Within each group the most recently registered converter is asked first, so a registration overrides an earlier one without removing it.

Registration is thread-safe and reads are lock-free: adding a converter replaces the map rather than mutating it, so a lookup already in flight completes against the map it started with.

Parameters

parent

The registry to fall back to when nothing here claims a value.

Constructors

Link copied to clipboard
constructor(parent: ResultConverterRegistry? = null)

Functions

Link copied to clipboard
fun addConverter(converter: ResultConverter<*, *>)

Registers a converter ahead of everything already here.

Link copied to clipboard
fun findConverter(sourceClass: KClass<*>, expectedType: KType, sourceType: PgType, context: DeserializationContext): ResultConverter<Any, *>?

Finds the converter that claims a value, searching this registry and then its parent.