Kotlin Utils
Utils API
Commons utilities for code generated by Utils Kapt or Kotlin apps in general.
Utils Kapt
KotlinPoet/Kapt utilities for Kotlin annotation processor (sub)components.
Add to your build:
dependencies {
// ...
api("com.github.manosbatsis.kotlin-utils:kotlin-utils-kapt:$kotlinpoetutils_version")
}
To use, add the ProcessingEnvironmentAware
to your annotation processor:
import javax.annotation.processing.AbstractProcessor.AbstractProcessor
import com.github.manosbatsis.kotlin.utils.ProcessingEnvironmentAware
class MyAnnotationProcessor : AbstractProcessor(), ProcessingEnvironmentAware {
/**
* Implement [ProcessingEnvironmentAware.processingEnvironment]
* for access to a [ProcessingEnvironment]
*/
override val processingEnvironment: ProcessingEnvironment by lazy {
processingEnv
}
}
... or sub-component:
import javax.annotation.processing.AbstractProcessor.AbstractProcessor
import com.github.manosbatsis.kotlin.utils.ProcessingEnvironmentAware
class MyCustomAnnotationProcessingComponent(
override val processingEnvironment: ProcessingEnvironment
) : ProcessingEnvironmentAware {
fun doSometing(){
// Do it!
}
}