Plugins
The processor can be extended by implementing a module using the plugin-api. Konvert already comes with some plugins.
Usage of plugin modules
Have a look at the example project or follow these simple steps:
-
Add dependency to
konvert-spring-annotationsdependencies { implementation("io.mcarle:konvert-spring-annotations:$konvertVersion") } -
Add
@KComponentannotation to your@Konverterannotated interface@Konverter @KComponent interface MyMapper { fun mapSomething(source: SourceClass): TargetClass } -
Add
konvert-spring-injectoras a KSP dependencydependencies { ksp("io.mcarle:konvert-spring-injector:$konvertVersion") }
This will then generate something like the following during compilation:
@Component
class MyMapperImpl: MyMapper {
override fun mapSomething(source: SourceClass): TargetClass {
// ...
}
}