perform narrowing in reflective property accessor read methods as well
This commit is contained in:
parent
c306afed63
commit
9ece4a88a9
|
|
@ -138,7 +138,8 @@ public class ReflectivePropertyAccessor implements PropertyAccessor {
|
|||
if (method != null) {
|
||||
try {
|
||||
ReflectionUtils.makeAccessible(method);
|
||||
return new TypedValue(method.invoke(target),invoker.typeDescriptor);
|
||||
Object value = method.invoke(target);
|
||||
return new TypedValue(value, invoker.typeDescriptor.narrow(value));
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw new AccessException("Unable to access property '" + name + "' through getter", ex);
|
||||
|
|
@ -158,7 +159,8 @@ public class ReflectivePropertyAccessor implements PropertyAccessor {
|
|||
if (field != null) {
|
||||
try {
|
||||
ReflectionUtils.makeAccessible(field);
|
||||
return new TypedValue(field.get(target),invoker.typeDescriptor);
|
||||
Object value = field.get(target);
|
||||
return new TypedValue(value, invoker.typeDescriptor.narrow(value));
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw new AccessException("Unable to access field: " + name, ex);
|
||||
|
|
|
|||
Loading…
Reference in New Issue