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

gsonpath.adapter.standard.extension.ExtensionsLoader.kt Maven / Gradle / Ivy

Go to download

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

The newest version!
package gsonpath.adapter.standard.extension

import gsonpath.ProcessingException
import gsonpath.compiler.GsonPathExtension
import gsonpath.util.Logger
import java.util.*

object ExtensionsLoader {

    fun loadExtensions(logger: Logger): List {
        // Load any extensions that are also available at compile time.
        println()
        val extensions: List =
                try {
                    ServiceLoader.load(GsonPathExtension::class.java, javaClass.classLoader).toList()

                } catch (t: Throwable) {
                    throw ProcessingException("Failed to load one or more GsonPath extensions. Cause: ${t.message}")
                }

        // Print the extensions for auditing purposes.
        extensions.forEach {
            logger.printMessage("Extension found: " + it.extensionName)
        }

        return extensions
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy