Hi Samir, This issue is now implemented in jOOQ 3.12: https://github.com/jOOQ/jOOQ/issues/5412
Generated records will now contain mapper() and unmapper() methods that produce non-reflective RecordMapper and RecordUnmapper instances in case both records and pojos are being generated. Thanks, Lukas On Thursday, July 7, 2016 at 4:50:21 AM UTC+2, csgeek wrote: > > 1. One conversion that would be useful to have is the ability to convert > from POJOs to Records and vice versa. > > On occasion I need to roll out my own POJO because our data is represented > different at the service layer then how the data > is actually stored, but I find myself using the autogenerated records and > POJOs a good bit. It would be nice if there was an easy way to going from > say: > > TableNameRecord --> TableName (pojo) and back. > > It varies on my use case but I tend to usually fetchInto( . class) and > most of the the class passed in is either the record or pojo that was > generated by jooq. > > -- > Samir Faci > > > > On Wed, Jul 6, 2016 at 5:16 AM, Lukas Eder <[email protected]> wrote: > >> Dear group, >> >> Part of jOOQ's success is its incredible amount of convenience methods >> that help reduce the boiler plate code at your side. We do this with >> massive overloading of API, for instance, when you work with fetch(), you >> may have noticed how many different types of fetch() there are in jOOQ. >> >> Just now, I have added yet another convenience method. A Converter >> constructor: >> https://github.com/jOOQ/jOOQ/issues/5398 >> >> It looks like this: >> >> static <T, U> Converter<T, U> of( >> Class<T> fromType, >> Class<U> toType, >> Function<? super T, ? extends U> from, >> Function<? super U, ? extends T> to >> ) { ... } >> >> And also: >> >> static <T, U> Converter<T, U> ofNullable( >> Class<T> fromType, >> Class<U> toType, >> Function<? super T, ? extends U> from, >> Function<? super U, ? extends T> to >> ) { >> return of( >> fromType, >> toType, >> t -> t == null ? null : from.apply(t), >> u -> u == null ? null : to.apply(u) >> ); >> } >> >> >> The above allows for creating simple ad-hoc, one-liner converters, such >> as: >> >> Converter<String, Integer> converter = >> Converter.ofNullable(String.class, Integer.class, Integer::parseInt, >> Object::toString); >> >> What's your biggest "itch" in the jOOQ API, which jOOQ could "scratch", >> or rather, make go away by adding new convenience API? >> >> All ideas welcome! >> Lukas >> >> -- >> You received this message because you are subscribed to the Google Groups >> "jOOQ User Group" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Thank you > Samir Faci > https://keybase.io/csgeek > -- You received this message because you are subscribed to the Google Groups "jOOQ User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/7007e64b-daf1-496a-b7c8-fec78aee6d12%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
