I'm trying to implement Spring's RowMapper interface, however, my IDE is prompting me to cast the return object to "T" and I don't understand why. Can anyone explain what I'm missing?
public class UserMapper<T> implements RowMapper<T> {
public T mapRow(ResultSet rs, int row) throws SQLException {
User user = new User();
user.firstName(rs.getInt("fname"));
user.lastName(rs.getFloat("lname"));
return user; // Why am I being prompted to cast this to "T", should this be fine?
}
}