Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/manosbatsis/kotlin-utils
KotlinPoet Annotation Processor Utilities
https://github.com/manosbatsis/kotlin-utils
Last synced: about 2 months ago
JSON representation
KotlinPoet Annotation Processor Utilities
- Host: GitHub
- URL: https://github.com/manosbatsis/kotlin-utils
- Owner: manosbatsis
- License: lgpl-3.0
- Created: 2019-11-30T09:33:01.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-06-09T01:52:45.000Z (over 2 years ago)
- Last Synced: 2023-08-01T13:12:07.932Z (over 1 year ago)
- Language: Kotlin
- Size: 172 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Kotlin Utils [![Maven Central](https://img.shields.io/maven-central/v/com.github.manosbatsis.kotlin-utils/kotlin-utils-api.svg)](https://repo1.maven.org/maven2/com/github/manosbatsis/kotlin-utils/kotlin-utils-api/)
## Utils API
Commons utilities for code generated by [Utils Kapt](#utils-kapt) or Kotlin apps in general.
## Utils Kapt
KotlinPoet/Kapt utilities for Kotlin annotation processor (sub)components.
Add to your build:
```groovy
dependencies {
// ...
api("com.github.manosbatsis.kotlin-utils:kotlin-utils-kapt:$kotlinpoetutils_version")
}
```To use, add the `ProcessingEnvironmentAware` to your annotation processor:
```kotlin
import javax.annotation.processing.AbstractProcessor.AbstractProcessor
import com.github.manosbatsis.kotlin.utils.ProcessingEnvironmentAwareclass MyAnnotationProcessor : AbstractProcessor(), ProcessingEnvironmentAware {
/**
* Implement [ProcessingEnvironmentAware.processingEnvironment]
* for access to a [ProcessingEnvironment]
*/
override val processingEnvironment: ProcessingEnvironment by lazy {
processingEnv
}
}
```... or sub-component:
```kotlin
import javax.annotation.processing.AbstractProcessor.AbstractProcessor
import com.github.manosbatsis.kotlin.utils.ProcessingEnvironmentAwareclass MyCustomAnnotationProcessingComponent(
override val processingEnvironment: ProcessingEnvironment
) : ProcessingEnvironmentAware {
fun doSometing(){
// Do it!
}}
```