I have methods that take a Record as an argument. This is because the 
method can be entered from multiple other methods, each having their own 
query. So in this case I don't always know if a certain field is present in 
the Record. For this I created a helper method: 

    public static <T> T optionalValueForField(Record record, Field<T> field) 
{
        int i = record.fieldsRow().indexOf(field);
        if (i < 0) {
            return null;
        }
        return record.get(i, field.getType());
    }

(and some variants of it). Some might prefer Optional<T> as a return type, 
but this works for me. 



Op woensdag 6 juli 2016 14:16:44 UTC+2 schreef Lukas Eder:
>
> 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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jooq-user/f68f9ec1-d658-42fe-8320-40fd1b188b40%40googlegroups.com.

Reply via email to