Is automapping to a concrete class gone?
kdurnoga opened this issue · 5 comments
I've just migrated from rxjava-jdbc to rxjava2-jdbc and noticed that automapping to a concrete class feature is missing. That was a really useful tiny little thing. Can we hope it returns at some point?
Yeah I did leave it out intentionally mainly because of type safety. If your constructor changes then you get no compile time indication and the complication of multiple constructors made the approach a bit unattractive to me. Probably your easiest workaround is to use an intermediate Tuple:
db.select("select name, score from person")
.getAs(String.class, Integer.class)
.map(x -> new Person(x._1, x._2));
I see, a pity. Working with tuples becomes cumbersome when the number of columns grows and you have to explicitly specify the type of each of them. Is it possible to reintroduce this functionality, possibly in some utility class?
So I'll mark it as an enhancement and pop it on my backlog. The code can be copied from rxjava-jdbc
but I'd like to revisit some of the validation stuff (like the existence of multiple constructors with the same number of parameters for instance).
Much appreciated!
@davidmoten I tried to fix this issue here: #53. Please let me know your thoughts!