Skip to content

Commit

Permalink
workaround duplicate findViewConfigPropertyDescriptor"
Browse files Browse the repository at this point in the history
See: #194
  • Loading branch information
sdelamo committed Dec 11, 2018
1 parent 9e4d13e commit 9bc0bbb
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ trait GenericViewConfiguration implements ViewConfiguration, GrailsApplicationAw
String moduleName = viewModuleName
GroovyObject configObject = (GroovyObject)this
if (config != null) {
def descriptors = findViewConfigPropertyDescriptor()
PropertyDescriptor[] descriptors = BeanUtils.getPropertyDescriptors(GenericViewConfiguration)
for (PropertyDescriptor desc in descriptors) {
if (desc.writeMethod != null) {
String propertyName = desc.name
Expand Down Expand Up @@ -131,8 +131,4 @@ trait GenericViewConfiguration implements ViewConfiguration, GrailsApplicationAw
}
packages as String[]
}

PropertyDescriptor[] findViewConfigPropertyDescriptor() {
BeanUtils.getPropertyDescriptors(GenericViewConfiguration)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package grails.views
import grails.util.GrailsUtil
import org.grails.config.CodeGenConfig
import spock.lang.IgnoreIf
import org.springframework.beans.BeanUtils
import java.beans.PropertyDescriptor
import spock.lang.Specification

//Fixed in 3.2.5
Expand Down Expand Up @@ -34,4 +36,8 @@ class TestClass implements GenericViewConfiguration {
String getViewModuleName() {
"json"
}

PropertyDescriptor[] findViewConfigPropertyDescriptor() {
BeanUtils.getPropertyDescriptors(GenericViewConfiguration)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ package grails.plugin.json.view

import grails.views.GenericViewConfiguration
import grails.web.mime.MimeType
import org.springframework.beans.BeanUtils
import org.springframework.boot.context.properties.ConfigurationProperties

import java.beans.PropertyDescriptor

/**
* Default configuration for JSON views
*
Expand All @@ -29,4 +32,9 @@ class JsonViewConfiguration implements GenericViewConfiguration {
String getViewModuleName() {
MODULE_NAME
}

PropertyDescriptor[] findViewConfigPropertyDescriptor() {
BeanUtils.getPropertyDescriptors(GenericViewConfiguration)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,10 @@ class MarkupViewConfiguration extends TemplateConfiguration implements GenericVi
MODULE_NAME
}

@Override
PropertyDescriptor[] findViewConfigPropertyDescriptor() {
def allDescriptors = []
allDescriptors.addAll(
GenericViewConfiguration.super.findViewConfigPropertyDescriptor()
)
allDescriptors.addAll(
BeanUtils.getPropertyDescriptors(TemplateConfiguration)
)
List<PropertyDescriptor> allDescriptors = []
allDescriptors.addAll(BeanUtils.getPropertyDescriptors(GenericViewConfiguration))
allDescriptors.addAll(BeanUtils.getPropertyDescriptors(TemplateConfiguration))
return allDescriptors as PropertyDescriptor[]
}
}

0 comments on commit 9bc0bbb

Please sign in to comment.