-
Notifications
You must be signed in to change notification settings - Fork 34
/
GsonGrailsPlugin.groovy
47 lines (40 loc) · 1.81 KB
/
GsonGrailsPlugin.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import grails.plugin.gson.adapters.GrailsDomainDeserializer
import grails.plugin.gson.adapters.GrailsDomainSerializer
import grails.plugin.gson.converters.GsonParsingParameterCreationListener
import grails.plugin.gson.spring.GsonBuilderFactory
import grails.plugin.gson.support.proxy.DefaultEntityProxyHandler
import grails.plugin.gson.support.proxy.ProxyHandlerFacade
class GsonGrailsPlugin {
def version = '1.2-SNAPSHOT'
def grailsVersion = '2.0 > *'
def dependsOn = [:]
def loadAfter = ['controllers', 'converters']
def pluginExcludes = [
'grails-app/views/**/*'
]
def title = 'Gson Plugin'
def author = 'Rob Fletcher'
def authorEmail = '[email protected]'
def description = 'Provides alternate JSON (de)serialization using Google\'s Gson library'
def documentation = 'http://git.io/grails-gson'
def license = 'APACHE'
def organization = [name: 'Freeside Software', url: 'http://freeside.co']
def issueManagement = [system: 'GitHub', url: 'https://github.com/robfletcher/grails-gson/issues']
def scm = [url: 'https://github.com/robfletcher/grails-gson']
def doWithSpring = {
if (!manager?.hasGrailsPlugin('hibernate')) {
proxyHandler DefaultEntityProxyHandler
}
proxyFacade ProxyHandlerFacade, ref('proxyHandler')
domainSerializer GrailsDomainSerializer, ref('grailsApplication'), ref('proxyFacade')
domainDeserializer GrailsDomainDeserializer, ref('grailsApplication')
gsonBuilder GsonBuilderFactory
jsonParsingParameterCreationListener GsonParsingParameterCreationListener, ref('gsonBuilder')
}
def doWithDynamicMethods = { ctx ->
def enhancer = new grails.plugin.gson.api.ArtefactEnhancer(application, ctx.gsonBuilder, ctx.domainDeserializer)
enhancer.enhanceRequest()
enhancer.enhanceControllers()
enhancer.enhanceDomains()
}
}