Skip to content

Commit

Permalink
GRAILS-10838 - refactor AbstractStructuredBindingEditor to simplify s…
Browse files Browse the repository at this point in the history
…ubclasses
  • Loading branch information
Jeff Scott Brown committed Nov 26, 2013
1 parent 9fbc2c5 commit 3b3c9b6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,10 @@ class Employee {
class StucturedEmployeeEditor extends AbstractStructuredBindingEditor<Employee> {

@Override
public Employee getPropertyValue(Object obj, String propertyName, DataBindingSource bindingSource) {
def propertyMap = getPropertyValuesMap(propertyName, bindingSource)
public Employee getPropertyValue(Map values) {
def employee = new Employee()
employee.firstName = propertyMap.firstName
employee.lastName = propertyMap.lastName
employee.firstName = values.firstName
employee.lastName = values.lastName
employee
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ import org.grails.databinding.StructuredBindingEditor
@CompileStatic
abstract class AbstractStructuredBindingEditor<T> implements StructuredBindingEditor<T> {
abstract Class<? extends T> getTargetType()

@Override
public T getPropertyValue(Object obj, String propertyName, DataBindingSource bindingSource) {
def propertyMap = getPropertyValuesMap(propertyName, bindingSource)
getPropertyValue propertyMap
}

abstract T getPropertyValue(Map values)

/**
* A convenience method for extracting structured values from a DataBindingSource.
Expand Down

0 comments on commit 3b3c9b6

Please sign in to comment.