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

grails.plugin.json.view.internal.JsonViewsTransform.groovy Maven / Gradle / Ivy

There is a newer version: 6.1.0
Show newest version
package grails.plugin.json.view.internal

import grails.compiler.traits.TraitInjector
import grails.plugin.json.view.JsonViewWritableScript
import grails.views.compiler.ViewsTransform
import groovy.transform.CompileStatic
import groovy.transform.InheritConstructors
import org.codehaus.groovy.control.CompilePhase
import org.codehaus.groovy.transform.GroovyASTTransformation
import org.grails.core.io.support.GrailsFactoriesLoader

/**
 * @author Graeme ROcher
 * @since 1.0
 */
@GroovyASTTransformation(phase = CompilePhase.SEMANTIC_ANALYSIS)
@CompileStatic
@InheritConstructors
class JsonViewsTransform extends ViewsTransform {
    @Override
    protected List findTraitInjectors() {
        def injectors = super.findTraitInjectors()

        injectors += GrailsFactoriesLoader.loadFactories(TraitInjector).findAll() { TraitInjector ti ->
            ti.artefactTypes.contains(JsonViewWritableScript.TYPE)
        }
        return injectors
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy