All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gsonpath.adapter.standard.StandardAdapterFactory.kt Maven / Gradle / Ivy

Go to download

An annotation processor which generates Type Adapters for the Google Gson library

There is a newer version: 4.0.0
Show newest version
package gsonpath.adapter.standard

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 StandardAdapterFactory : AdapterFactory {

    override fun generateGsonAdapters(
            env: RoundEnvironment,
            logger: Logger,
            annotations: Set,
            dependencies: Dependencies): List {

        return getAnnotatedModelElements(env, annotations, listOf(ElementKind.CLASS, ElementKind.INTERFACE))
                .onEach { logger.printMessage("Generating TypeAdapter (${it.element})") }
                .map { dependencies.standardGsonAdapterGenerator.handle(it.element, it.annotation) }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy