Skip to main content Link Menu Expand (external link) Document Search Copy Copied

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:

  1. Add dependency to konvert-spring-annotations

    dependencies {
        implementation("io.mcarle:konvert-spring-annotations:3.2.2")
    }
  2. Add @KComponent annotation to your @Konverter annotated interface

    @Konverter
    @KComponent
    interface MyMapper {
        fun mapSomething(source: SourceClass): TargetClass
    }
  3. Add konvert-spring-injector as a KSP dependency

    dependencies {
        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 {
        // ...
    }
}