Skip to content

Commit

Permalink
Add missing javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
kaklakariada committed Dec 10, 2023
1 parent f579f0d commit 810f931
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/main/java/org/itsallcode/jdbc/resultset/RowMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,28 @@ private static <T> RowMapper<T> generic(final ColumnValuesConverter<T> converter
return new GenericRowMapper<>(converter);
}

public static <T> RowMapper<T> create(final Simple<T> mapper) {
/**
* Creates a new new {@link RowMapper} from a {@link SimpleRowMapper}.
* <p>
* Use this if the mapper doesn't need the {@link Context}.
*
* @param <T> generic row type
* @param mapper the simple row mapper
* @return a new {@link RowMapper}
*/
public static <T> RowMapper<T> create(final SimpleRowMapper<T> mapper) {
return (context, resultSet, rowNum) -> mapper.mapRow(resultSet, rowNum);
}

/**
* Converts a single row from a {@link ResultSet} to a generic row type.
* <p>
* Use this interface if you don't need the {@link Context}.
*
* @param <T> generic row type
*/
@FunctionalInterface
public interface Simple<T> {
public interface SimpleRowMapper<T> {
/**
* Converts a single row from a {@link ResultSet} to a generic row type.
*
Expand Down

0 comments on commit 810f931

Please sign in to comment.