gsonpath.adapter.enums.EnumAdapterFactory.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gsonpath-compiler Show documentation
Show all versions of gsonpath-compiler Show documentation
An annotation processor which generates Type Adapters for the Google Gson library
package gsonpath.adapter.enums
import gsonpath.AutoGsonAdapter
import gsonpath.adapter.AdapterFactory
import gsonpath.adapter.AdapterGenerationResult
import gsonpath.adapter.util.AdapterFactoryUtil.getAnnotatedModelElements
import gsonpath.dependencies.Dependencies
import gsonpath.util.Logger
import javax.annotation.processing.RoundEnvironment
import javax.lang.model.element.ElementKind
import javax.lang.model.element.TypeElement
object EnumAdapterFactory : AdapterFactory {
override fun generateGsonAdapters(
env: RoundEnvironment,
logger: Logger,
annotations: Set,
dependencies: Dependencies): List {
return getAnnotatedModelElements(env, annotations, listOf(ElementKind.ENUM))
.onEach { logger.printMessage("Generating TypeAdapter (${it.element})") }
.map { dependencies.enumGsonAdapterGenerator.handle(it.element, it.annotation) }
}
}