@Override public RowMapper<T> specialize(ResultSet rs, StatementContext ctx) throws SQLException { final List<String> columnNames = getColumnNames(rs); final List<ColumnNameMatcher> columnNameMatchers = ctx.getConfig(ReflectionMappers.class).getColumnNameMatchers(); final List<String> unmatchedColumns = new ArrayList<>(columnNames); RowMapper<T> mapper = specialize0(ctx, columnNames, columnNameMatchers, unmatchedColumns) .orElseThrow(() -> new IllegalArgumentException(String.format(NO_MATCHING_COLUMNS, type))); if (ctx.getConfig(ReflectionMappers.class).isStrictMatching() && anyColumnsStartWithPrefix(unmatchedColumns, prefix, columnNameMatchers)) { throw new IllegalArgumentException( String.format(UNMATCHED_COLUMNS_STRICT, type.getSimpleName(), unmatchedColumns)); } return mapper; }
String paramName = prefix + paramName(field); findColumnIndex(paramName, columnNames, columnNameMatchers, () -> debugName(field)) .ifPresent(index -> { QualifiedType<?> type = QualifiedType.of(field.getGenericType()) String nestedPrefix = prefix + anno.value().toLowerCase(); if (anyColumnsStartWithPrefix(columnNames, nestedPrefix, columnNameMatchers)) { nestedMappers .computeIfAbsent(field, f -> new FieldMapper<>(field.getType(), nestedPrefix))
final String paramName = prefix + paramName(parameters, i, constructorProperties); final OptionalInt columnIndex = findColumnIndex(paramName, columnNames, columnNameMatchers, () -> debugName(parameter));
String paramName = prefix + getName(property); findColumnIndex(paramName, columnNames, columnNameMatchers, () -> debugName(property)) .ifPresent(index -> { @SuppressWarnings({ "unchecked", "rawtypes" }) } else { String nestedPrefix = prefix + anno.value(); if (anyColumnsStartWithPrefix(columnNames, nestedPrefix, columnNameMatchers)) { nestedMappers .computeIfAbsent(property, d -> createNestedMapper(ctx, d, nestedPrefix))
@Override public RowMapper<T> specialize(ResultSet rs, StatementContext ctx) throws SQLException { final List<String> columnNames = getColumnNames(rs); final List<ColumnNameMatcher> columnNameMatchers = ctx.getConfig(ReflectionMappers.class).getColumnNameMatchers(); final List<String> unmatchedColumns = new ArrayList<>(columnNames); RowMapper<T> result = specialize0(ctx, columnNames, columnNameMatchers, unmatchedColumns) .orElseThrow(() -> new IllegalArgumentException(String.format(NO_MATCHING_COLUMNS, type))); if (ctx.getConfig(ReflectionMappers.class).isStrictMatching() && anyColumnsStartWithPrefix(unmatchedColumns, prefix, columnNameMatchers)) { throw new IllegalArgumentException( String.format(UNMATCHED_COLUMNS_STRICT, type.getSimpleName(), unmatchedColumns)); } return result; }
@Override public RowMapper<T> specialize(ResultSet rs, StatementContext ctx) throws SQLException { final List<String> columnNames = getColumnNames(rs); final List<ColumnNameMatcher> columnNameMatchers = ctx.getConfig(ReflectionMappers.class).getColumnNameMatchers(); final List<String> unmatchedColumns = new ArrayList<>(columnNames); RowMapper<T> mapper = specialize0(ctx, columnNames, columnNameMatchers, unmatchedColumns) .orElseThrow(() -> new IllegalArgumentException(String.format( UNMATCHED_CONSTRUCTOR_PARAMETERS, factory))); if (ctx.getConfig(ReflectionMappers.class).isStrictMatching() && anyColumnsStartWithPrefix(unmatchedColumns, prefix, columnNameMatchers)) { throw new IllegalArgumentException( String.format(UNMATCHED_COLUMNS_STRICT, factory, unmatchedColumns)); } return mapper; }