Skip to content

Commit

Permalink
Revert "workaround duplicate findViewConfigPropertyDescriptor""
Browse files Browse the repository at this point in the history
Close: #194
  • Loading branch information
sdelamo committed Jan 2, 2019
1 parent 2d5aa57 commit 06ab2e1
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 19 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) {
PropertyDescriptor[] descriptors = BeanUtils.getPropertyDescriptors(GenericViewConfiguration)
def descriptors = findViewConfigPropertyDescriptor()
for (PropertyDescriptor desc in descriptors) {
if (desc.writeMethod != null) {
String propertyName = desc.name
Expand Down Expand Up @@ -131,4 +131,8 @@ trait GenericViewConfiguration implements ViewConfiguration, GrailsApplicationAw
}
packages as String[]
}

PropertyDescriptor[] findViewConfigPropertyDescriptor() {
BeanUtils.getPropertyDescriptors(GenericViewConfiguration)
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package grails.views

import grails.util.GrailsUtil
import org.grails.config.CodeGenConfig
import org.springframework.beans.BeanUtils
import java.beans.PropertyDescriptor
import spock.lang.Specification

class GenericViewConfigurationSpec extends Specification {
Expand Down Expand Up @@ -33,8 +30,4 @@ 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,11 +2,8 @@ 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 @@ -32,9 +29,4 @@ 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,10 +57,15 @@ class MarkupViewConfiguration extends TemplateConfiguration implements GenericVi
MODULE_NAME
}

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

0 comments on commit 06ab2e1

Please sign in to comment.