DATACMNS-642 - Avoid setter lookup in BeanWrapper for if field access is used.

We now delay the lookup of the setter method until we discover we really  need to use property access.
This commit is contained in:
Oliver Gierke
2015-02-04 17:11:48 +01:00
parent a17100568c
commit ff6d0dda9d

View File

@@ -66,8 +66,6 @@ public class BeanWrapper<T> {
Assert.notNull(property, "PersistentProperty must not be null!");
Method setter = property.getSetter();
try {
if (!property.usePropertyAccess()) {
@@ -75,8 +73,12 @@ public class BeanWrapper<T> {
Object valueToSet = getPotentiallyConvertedValue(value, property.getType());
ReflectionUtils.makeAccessible(property.getField());
ReflectionUtils.setField(property.getField(), bean, valueToSet);
return;
}
} else if (property.usePropertyAccess() && setter != null) {
Method setter = property.getSetter();
if (property.usePropertyAccess() && setter != null) {
Class<?>[] paramTypes = setter.getParameterTypes();
Object valueToSet = getPotentiallyConvertedValue(value, paramTypes[0]);