java - Implementing interface with generic type -


i'm trying implement spring's rowmapper interface, however, ide prompting me cast return object "t" , don't understand why. can explain 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 being prompted cast "t", should fine?     } } 

if row maps user, should rowmapper<user>

ie:

 public class usermapper implements rowmapper<user> {     public user maprow(resultset rs, int row) throws sqlexception {         user user = new user();         user.firstname(rs.getint("fname"));         user.lastname(rs.getfloat("lname"));         return user;     } } 

Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -