FieldLoader

interface FieldLoader

Interface for custom field deserialization during config loading.

Implement this interface to define a custom conversion strategy for a specific field. It is used in conjunction with the net.ririfa.yacla.annotation.CustomLoader annotation.

This allows transforming raw parsed values (e.g., from YAML/JSON) into complex or validated types.

Example:

class EnumListLoader : FieldLoader {
override fun load(raw: Any?): Any? {
return (raw as? List<*>)?.mapNotNull { MyEnum.valueOf(it.toString()) }
}
}

Functions

Link copied to clipboard
abstract fun load(raw: Any?): Any?

Transforms a raw parsed value into the final field value.