cool. Tks Lukas.
2016-07-22 8:30 GMT+02:00 Lukas Eder <[email protected]>: > Hi Denis, > > Sorry, I thought that there was an Unchecked.sneakyThrow() public method, > but there isn't. It's package-private in SeqUtils. Will add that > immediately: > https://github.com/jOOQ/jOOL/issues/239 > > The other methods can't really be used with RecordMapper. Well, they can, > but they won't add a lot of value... > > Lukas > > > 2016-07-21 19:41 GMT+02:00 Denis Miorandi <[email protected]>: > >> tks Lukas, >> I'm going to just catch Exception and throw a RunTimeException. >> This is enough. >> >> Just cause I'm curious >> >> Can Unchecked.consumer be used on .fetch().map(new RecordMapper.......) >> ??? >> Due to RecordMapper is a @FunctionalInterface i suppose it's possible but >> looking at code I didn't find the way. >> >> Tks >> Denis >> >> >> >> 2016-07-21 18:12 GMT+02:00 Lukas Eder <[email protected]>: >> >>> Very interesting question! >>> >>> Given that you don't know what to do with the checked exception means >>> that the checked exception probably shouldn't be checked in the first place >>> (e.g. SQLException, IOException, etc.). The common approach here is to wrap >>> it in a runtime exception (for SQLException, I suggest jOOQ's >>> DataAccessException). >>> >>> A bit less common is to "sneaky throw" the checked exception again: >>> >>> https://blog.jooq.org/2012/09/14/throw-checked-exceptions-like-runtime-exceptions-in-java/ >>> >>> You could also use jOOλ's Unchecked for this, possibly: >>> >>> https://github.com/jOOQ/jOOL/blob/master/src/main/java/org/jooq/lambda/Unchecked.java >>> >>> If you know you need to catch the specific checked exception somewhere >>> outside of that mapper, then you'll have to be creative. But chances are >>> high, you don't. >>> >>> I hope this helps, >>> Lukas >>> >>> 2016-07-21 17:53 GMT+02:00 Denis Miorandi <[email protected]>: >>> >>>> actually I use jooq mapper like this, but I don't know how to manage >>>> checked exception inside map method like throws. >>>> I know this is not stricly a jooq stuff, but: any suggestions to do it >>>> in a smart way? >>>> >>>> .fetchOne() >>>> .map(new RecordMapper<Record, MyType>() { >>>> @Override >>>> public MyType map(Record record) *throws HERE???* { >>>> .... >>>> * something that throw Exception * >>>> ..... >>>> } >>>> } >>>> >>>> >>>> Actually I've seen something similar >>>> >>>> >>>> - https://github.com/fge/throwing-lambdas >>>> - https://github.com/JeffreyFalgout/ThrowingStream >>>> >>>> >>>> -- >>>> 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. >>>> >>> >>> -- >>> You received this message because you are subscribed to a topic in the >>> Google Groups "jOOQ User Group" group. >>> To unsubscribe from this topic, visit >>> https://groups.google.com/d/topic/jooq-user/LJowoMTNEBc/unsubscribe. >>> To unsubscribe from this group and all its topics, send an email to >>> [email protected]. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> >> >> -- >> Dott. Denis Miorandi >> via dei Vignai 27 >> 38060 - Nogaredo (TN) >> >> >> >> -- >> 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. >> > > -- > You received this message because you are subscribed to a topic in the > Google Groups "jOOQ User Group" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/jooq-user/LJowoMTNEBc/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- Dott. Denis Miorandi via dei Vignai 27 38060 - Nogaredo (TN) -- 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.
