Source:
private Optional<RowMapper<T>> specialize0(StatementContext ctx, List<String> columnNames, List<ColumnNameMatcher> columnNameMatchers, List<String> unmatchedColumns) { final List<RowMapper<?>> mappers = new ArrayList<>(); final List<Field> fields = new ArrayList<>(); for (Class<?> aType = type; aType != null; aType = aType.getSuperclass()) { for (Field field : aType.getDeclaredFields()) { Nested anno = field.getAnnotation(Nested.class); if (anno == null) { String paramName = prefix + paramName(field); findColumnIndex(paramName, columnNames, columnNameMatchers, () -> debugName(field)) .ifPresent(index -> { QualifiedType<?> type = QualifiedType.of(field.getGenericType()) .withAnnotations(ctx.getConfig(Qualifiers.class).qualifiers(field)); @SuppressWarnings("unchecked") ColumnMapper<?> mapper = ctx.findColumnMapperFor(type) .orElse((ColumnMapper) (r, n, c) -> r.getObject(n)); mappers.add(new SingleColumnMapper<>(mapper, index + 1)); fields.add(field); unmatchedColumns.remove(columnNames.get(index)); }); } else { String nestedPrefix = prefix + anno.value().toLowerCase(); if (anyColumnsStartWithPrefix(columnNames, nestedPrefix, columnNameMatchers)) { nestedMappers .computeIfAbsent(field, f -> new FieldMapper<>(field.getType(), nestedPrefix)) .specialize0(ctx, columnNames, columnNameMatchers, unmatchedColumns) .ifPresent(mapper -> { mappers.add(mapper); fields.add(field); }); } } } } if (mappers.isEmpty() && !columnNames.isEmpty()) { return Optional.empty(); } return Optional.of((r, c) -> { T obj = construct(); for (int i = 0; i < mappers.size(); i++) { RowMapper<?> mapper = mappers.get(i); Field field = fields.get(i); Object value = mapper.map(r, ctx); writeField(obj, field, value); } return obj; }); }

Target:
private Optional<RowMapper<T>> specialize0(StatementContext ctx, List<String> columnNames, List<ColumnNameMatcher> columnNameMatchers, List<String> unmatchedColumns) { final List<RowMapper<?>> mappers = new ArrayList<>(); final List<Field> fields = new ArrayList<>(); for (Class<?> aType = type; aType != null; aType = aType.getSuperclass()) { for (Field field : aType.getDeclaredFields()) { Nested anno = field.getAnnotation(Nested.class); if (anno == null) { String paramName = prefix + paramName(field); findColumnIndex(paramName, columnNames, columnNameMatchers, () -> debugName(field)) .ifPresent(index -> { QualifiedType<?> type = QualifiedType.of(field.getGenericType()) .withAnnotations(ctx.getConfig(Qualifiers.class).findFor(field)); @SuppressWarnings("unchecked") ColumnMapper<?> mapper = ctx.findColumnMapperFor(type) .orElse((ColumnMapper) (r, n, c) -> r.getObject(n)); mappers.add(new SingleColumnMapper<>(mapper, index + 1)); fields.add(field); unmatchedColumns.remove(columnNames.get(index)); }); } else { String nestedPrefix = prefix + anno.value().toLowerCase(); if (anyColumnsStartWithPrefix(columnNames, nestedPrefix, columnNameMatchers)) { nestedMappers .computeIfAbsent(field, f -> new FieldMapper<>(field.getType(), nestedPrefix)) .specialize0(ctx, columnNames, columnNameMatchers, unmatchedColumns) .ifPresent(mapper -> { mappers.add(mapper); fields.add(field); }); } } } } if (mappers.isEmpty() && !columnNames.isEmpty()) { return Optional.empty(); } return Optional.of((r, c) -> { T obj = construct(); for (int i = 0; i < mappers.size(); i++) { RowMapper<?> mapper = mappers.get(i); Field field = fields.get(i); Object value = mapper.map(r, ctx); writeField(obj, field, value); } return obj; }); }