Field Loader
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()) }
}
}Content copied to clipboard