Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch '2.2.x'

  • Loading branch information...
commit 09072bdc685f234d7b4e77254eebe73a19f25e0b 2 parents 5220254 + dc4b463
graemerocher graemerocher authored
2  build.gradle
@@ -24,7 +24,7 @@ ext {
24 24 commonsCollectionsVersion = "3.2.1"
25 25 commonsIOVersion = "2.1"
26 26 commonsLangVersion = "2.6"
27   - datastoreVersion = "1.1.1.BUILD-SNAPSHOT"
  27 + datastoreVersion = "1.1.1.RELEASE"
28 28 gantVersion = "1.9.6"
29 29 gdocEngineVersion = "1.0.1"
30 30 groovyVersion = "2.0.5"
2  grails-bootstrap/src/main/groovy/org/codehaus/groovy/grails/resolve/GrailsCoreDependencies.java
@@ -174,7 +174,7 @@ public Object doCall() {
174 174 };
175 175 registerDependencies(dependencyManager, compileTimeDependenciesMethod, commonsExcludingLoggingAndXmlApis, "commons-logging", "xml-apis", "commons-digester");
176 176
177   - String datastoreMappingVersion = "1.1.1.BUILD-SNAPSHOT";
  177 + String datastoreMappingVersion = "1.1.1.RELEASE";
178 178 ModuleRevisionId[] compileDependencies = {
179 179 ModuleRevisionId.newInstance("aopalliance", "aopalliance", "1.0"),
180 180 ModuleRevisionId.newInstance("com.googlecode.concurrentlinkedhashmap", "concurrentlinkedhashmap-lru", "1.2_jdk5"),
23 ...-converters/src/main/groovy/org/codehaus/groovy/grails/plugins/converters/ConvertersPluginSupport.groovy
@@ -28,6 +28,9 @@ import org.springframework.validation.Errors
28 28 import org.springframework.validation.BeanPropertyBindingResult
29 29 import grails.validation.ValidationErrors
30 30 import org.grails.datastore.mapping.validation.ValidationErrors
  31 +import groovy.transform.CompileStatic
  32 +import org.codehaus.groovy.grails.commons.GrailsDomainClass
  33 +import grails.artefact.Enhanced
31 34
32 35 /**
33 36 * @author Graeme Rocher
@@ -41,18 +44,34 @@ class ConvertersPluginSupport {
41 44 * @param application
42 45 * @param applicationContext
43 46 */
  47 + @CompileStatic
44 48 static void enhanceApplication(GrailsApplication application, ApplicationContext applicationContext) {
45 49 MetaClassEnhancer enhancer = new MetaClassEnhancer()
46 50 enhancer.addApi(new ConvertersApi(applicationContext:applicationContext))
47 51
48 52 // Override GDK asType for some common Interfaces and Classes
49   - enhancer.enhanceAll([Errors,BeanPropertyBindingResult, ValidationErrors, ValidationErrors, ArrayList, TreeSet, HashSet, List, Set, Collection, GroovyObject, Object, Enum].collect {
50   - GrailsMetaClassUtils.getExpandoMetaClass(it)
  53 + enhancer.enhanceAll([Errors,BeanPropertyBindingResult, ValidationErrors, ValidationErrors, ArrayList, TreeSet, HashSet, List, Set, Collection, GroovyObject, Object, Enum].collect { Class c ->
  54 + GrailsMetaClassUtils.getExpandoMetaClass(c)
51 55 })
52 56
  57 +
  58 + enhanceRequest()
  59 + enhanceDomainClasses(application, enhancer)
  60 + }
  61 +
  62 + static void enhanceDomainClasses(GrailsApplication grailsApplication, MetaClassEnhancer metaClassEnhancer) {
  63 + for(GrailsDomainClass dc in grailsApplication.domainClasses) {
  64 + if(!dc.getClazz().getAnnotation(Enhanced)) {
  65 + metaClassEnhancer.enhance(dc.metaClass)
  66 + }
  67 + }
  68 + }
  69 +
  70 + private static void enhanceRequest() {
53 71 // Methods for Reading JSON/XML from Requests
54 72 def getXMLMethod = { -> XML.parse((HttpServletRequest) delegate) }
55 73 def getJSONMethod = { -> JSON.parse((HttpServletRequest) delegate) }
  74 +
56 75 def requestMc = GroovySystem.metaClassRegistry.getMetaClass(HttpServletRequest)
57 76 requestMc.getXML = getXMLMethod
58 77 requestMc.getJSON = getJSONMethod

0 comments on commit 09072bd

Please sign in to comment.
Something went wrong with that request. Please try again.