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

graphql.kickstart.tools.JavassistProxyHandler.kt Maven / Gradle / Ivy

There is a newer version: 14.0.0
Show newest version
package graphql.kickstart.tools

import javassist.util.proxy.ProxyFactory


/**
 * @author Marcus Thiesen
 */

class JavassistProxyHandler : ProxyHandler {

    private val isEnabled: Boolean =
            try {
                Class.forName("javassist.util.proxy.ProxyFactory")
                true
            } catch (_: ClassNotFoundException) {
                false
            }

    override fun canHandle(resolver: GraphQLResolver<*>?): Boolean {
        return isEnabled && ProxyFactory.isProxyClass(resolver?.javaClass)
    }

    override fun getTargetClass(resolver: GraphQLResolver<*>?): Class<*> = resolver!!.javaClass.superclass
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy