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<PojoProperty<T>> propList = new ArrayList<>(); for (PojoProperty<T> property : getProperties(ctx.getConfig()).getProperties().values()) { Nested anno = property.getAnnotation(Nested.class).orElse(null); if (property.getAnnotation(Unmappable.class).map(Unmappable::value).orElse(false)) { continue; } if (anno == null) { String paramName = prefix + getName(property); findColumnIndex(paramName, columnNames, columnNameMatchers, () -> debugName(property)) .ifPresent(index -> { @SuppressWarnings({ "unchecked", "rawtypes" }) ColumnMapper<?> mapper = ctx.findColumnMapperFor(box(property.getQualifiedType())) .orElseGet(() -> (ColumnMapper) defaultColumnMapper(property)); mappers.add(new SingleColumnMapper<>(mapper, index + 1)); propList.add(property); unmatchedColumns.remove(columnNames.get(index)); }); } else { String nestedPrefix = prefix + anno.value(); if (anyColumnsStartWithPrefix(columnNames, nestedPrefix, columnNameMatchers)) { nestedMappers .computeIfAbsent(property, d -> createNestedMapper(ctx, d, nestedPrefix)) .specialize0(ctx, columnNames, columnNameMatchers, unmatchedColumns) .ifPresent(nestedMapper -> { mappers.add(nestedMapper); propList.add(property); }); } } } if (mappers.isEmpty() && !columnNames.isEmpty()) { return Optional.empty(); } return Optional.of((r, c) -> { final PojoBuilder<T> pojo = getProperties(c.getConfig()).create(); for (int i = 0; i < mappers.size(); i++) { RowMapper<?> mapper = mappers.get(i); PojoProperty<T> property = propList.get(i); Object value = mapper.map(r, ctx); if (value != null) { pojo.set(property, value); } } return pojo.build(); }); }

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<PojoProperty<T>> propList = new ArrayList<>(); for (PojoProperty<T> property : getProperties(ctx.getConfig()).getProperties().values()) { Nested anno = property.getAnnotation(Nested.class).orElse(null); if (property.getAnnotation(Unmappable.class).map(Unmappable::value).orElse(false)) { continue; } if (anno == null) { String paramName = prefix + getName(property); findColumnIndex(paramName, columnNames, columnNameMatchers, () -> debugName(property)) .ifPresent(index -> { @SuppressWarnings({ "unchecked", "rawtypes" }) ColumnMapper<?> mapper = ctx.findColumnMapperFor(property.getQualifiedType().mapType(GenericTypes::box)) .orElseGet(() -> (ColumnMapper) defaultColumnMapper(property)); mappers.add(new SingleColumnMapper<>(mapper, index + 1)); propList.add(property); unmatchedColumns.remove(columnNames.get(index)); }); } else { String nestedPrefix = prefix + anno.value(); if (anyColumnsStartWithPrefix(columnNames, nestedPrefix, columnNameMatchers)) { nestedMappers .computeIfAbsent(property, d -> createNestedMapper(ctx, d, nestedPrefix)) .specialize0(ctx, columnNames, columnNameMatchers, unmatchedColumns) .ifPresent(nestedMapper -> { mappers.add(nestedMapper); propList.add(property); }); } } } if (mappers.isEmpty() && !columnNames.isEmpty()) { return Optional.empty(); } return Optional.of((r, c) -> { final PojoBuilder<T> pojo = getProperties(c.getConfig()).create(); for (int i = 0; i < mappers.size(); i++) { RowMapper<?> mapper = mappers.get(i); PojoProperty<T> property = propList.get(i); Object value = mapper.map(r, ctx); if (value != null) { pojo.set(property, value); } } return pojo.build(); }); }