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-annotations
dependencies { implementation("io.mcarle:konvert-spring-annotations:3.2.2") }
-
Add
@KComponent
annotation to your@Konverter
annotated interface@Konverter @KComponent interface MyMapper { fun mapSomething(source: SourceClass): TargetClass }
-
Add
konvert-spring-injector
as a KSP dependencydependencies { ksp("io.mcarle:konvert-spring-injector:3.2.2") }
This will then generate something like the following during compilation:
@Component
class MyMapperImpl: MyMapper {
override fun mapSomething(source: SourceClass): TargetClass {
// ...
}
}