Browse Source

Restore AbstractPropertyAccessor

Commit 3d86f15 added a lot of new feature in AbstractPropertyAccessor
shared by both DirectFieldAccessor and BeanWrapperImpl. This makes this
abstract class harder to implement for others having simpler use cases.

It turns that Spring Data has such use case; this commit split these new
features in a dedicated new base class, leaving AbstractPropertyAccessor
untouched.

Issue: SPR-12805
pull/808/head
Stephane Nicoll 10 years ago
parent
commit
2dc674f356
  1. 1058
      spring-beans/src/main/java/org/springframework/beans/AbstractNestablePropertyAccessor.java
  2. 1040
      spring-beans/src/main/java/org/springframework/beans/AbstractPropertyAccessor.java
  3. 2
      spring-beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java
  4. 2
      spring-beans/src/main/java/org/springframework/beans/DirectFieldAccessor.java
  5. 4
      spring-beans/src/test/java/org/springframework/beans/AbstractPropertyAccessorTests.java
  6. 2
      spring-beans/src/test/java/org/springframework/beans/BeanWrapperTests.java
  7. 2
      spring-beans/src/test/java/org/springframework/beans/DirectFieldAccessorTests.java

1058
spring-beans/src/main/java/org/springframework/beans/AbstractNestablePropertyAccessor.java

File diff suppressed because it is too large Load Diff

1040
spring-beans/src/main/java/org/springframework/beans/AbstractPropertyAccessor.java

File diff suppressed because it is too large Load Diff

2
spring-beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java

@ -60,7 +60,7 @@ import org.springframework.util.Assert; @@ -60,7 +60,7 @@ import org.springframework.util.Assert;
* @see BeanWrapper
* @see PropertyEditorRegistrySupport
*/
public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWrapper {
public class BeanWrapperImpl extends AbstractNestablePropertyAccessor implements BeanWrapper {
/**
* Cached introspections results for this object, to prevent encountering

2
spring-beans/src/main/java/org/springframework/beans/DirectFieldAccessor.java

@ -44,7 +44,7 @@ import org.springframework.util.ReflectionUtils; @@ -44,7 +44,7 @@ import org.springframework.util.ReflectionUtils;
* @see org.springframework.validation.DirectFieldBindingResult
* @see org.springframework.validation.DataBinder#initDirectFieldAccess()
*/
public class DirectFieldAccessor extends AbstractPropertyAccessor {
public class DirectFieldAccessor extends AbstractNestablePropertyAccessor {
private final Map<String, FieldPropertyHandler> fieldMap = new HashMap<String, FieldPropertyHandler>();

4
spring-beans/src/test/java/org/springframework/beans/AbstractConfigurablePropertyAccessorTests.java → spring-beans/src/test/java/org/springframework/beans/AbstractPropertyAccessorTests.java

@ -76,7 +76,7 @@ import static org.junit.Assert.*; @@ -76,7 +76,7 @@ import static org.junit.Assert.*;
* @author Dave Syer
* @author Stephane Nicoll
*/
public abstract class AbstractConfigurablePropertyAccessorTests {
public abstract class AbstractPropertyAccessorTests {
@Rule
public final ExpectedException thrown = ExpectedException.none();
@ -1035,7 +1035,7 @@ public abstract class AbstractConfigurablePropertyAccessorTests { @@ -1035,7 +1035,7 @@ public abstract class AbstractConfigurablePropertyAccessorTests {
@Test
public void setPrimitiveArrayPropertyLargeMatching() {
Assume.group(TestGroup.PERFORMANCE);
Assume.notLogging(LogFactory.getLog(AbstractConfigurablePropertyAccessorTests.class));
Assume.notLogging(LogFactory.getLog(AbstractPropertyAccessorTests.class));
PrimitiveArrayBean target = new PrimitiveArrayBean();
AbstractPropertyAccessor accessor = createAccessor(target);

2
spring-beans/src/test/java/org/springframework/beans/BeanWrapperTests.java

@ -36,7 +36,7 @@ import static org.junit.Assert.*; @@ -36,7 +36,7 @@ import static org.junit.Assert.*;
* @author Chris Beams
* @author Dave Syer
*/
public final class BeanWrapperTests extends AbstractConfigurablePropertyAccessorTests {
public final class BeanWrapperTests extends AbstractPropertyAccessorTests {
@Override
protected BeanWrapperImpl createAccessor(Object target) {

2
spring-beans/src/test/java/org/springframework/beans/DirectFieldAccessorTests.java

@ -29,7 +29,7 @@ import static org.junit.Assert.*; @@ -29,7 +29,7 @@ import static org.junit.Assert.*;
* @author Chris Beams
* @@author Stephane Nicoll
*/
public class DirectFieldAccessorTests extends AbstractConfigurablePropertyAccessorTests {
public class DirectFieldAccessorTests extends AbstractPropertyAccessorTests {
@Override
protected DirectFieldAccessor createAccessor(Object target) {

Loading…
Cancel
Save