in wrapper/src/main/java/software/amazon/jdbc/util/WrapperUtils.java [525:568]
public static Object getFieldValue(Object target, final String accessor) {
if (target == null) {
return null;
}
final List<String> fieldNames = StringUtils.split(accessor, "\\.", true);
Class<?> targetClass = target.getClass();
for (final String fieldName : fieldNames) {
Field field = null;
while (targetClass != null && field == null) {
try {
field = targetClass.getDeclaredField(fieldName);
} catch (final Exception ex) {
// try parent class
targetClass = targetClass.getSuperclass();
}
}
if (field == null) {
return null; // field not found
}
if (!field.isAccessible()) {
field.setAccessible(true);
}
final Object fieldValue;
try {
fieldValue = field.get(target);
} catch (final Exception ex) {
return null;
}
if (fieldValue == null) {
return null;
}
target = fieldValue;
targetClass = target.getClass();
}
return target;
}