Hi, I must admit, this use-case has not occurred to me yet. Indeed, my default answer here would have been to just use ResultQuery.fetch(Field) instead (for your particular example), but there are many other situations where such a method would be useful for any type of Iterable<? extends Record> or Stream<? extends Record>.
E.g. when using Stream.sorted() with Comparator.comparing(): https://docs.oracle.com/javase/8/docs/api/java/util/Comparator.html#comparing-java.util.function.Function- Example: final Result<Record> res = //... res.stream() .sorted(comparing(MY_TABLE.MY_FIELD::get)) .forEach(System.out::println); We'll add this for the next release: https://github.com/jOOQ/jOOQ/issues/5120 I like brevity, so the method is probably going to be called Field.get(Record) (similar to the new Record.get(Field) that is introduced in jOOQ 3.8) Thanks again for your suggestion! Lukas 2016-02-27 2:22 GMT+01:00 <[email protected]>: > I would absolutely love to have methods in Fields like: > > public T getValueFor(final Record record) { > > return record.getValue(this); > > } > > It'd be really neat to have, along with all the other *Java8* lambdas, so > it could be used like follows: > > final Result<Record> res = //... > > res.stream().map(Tables.MY_TABLE.MY_FIELD::getValueFor).forEach(System.out::println); > > I do realize my example does obviously not demonstrate the need for such a > feature, 'cause I could have just used > /*...*/.fetch(Tables.MY_TABLE.MY_FIELD); > instead. It's just intended for showing its potential usage. > > What do you guys think? > > -- > 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 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.
