2016-06-08 9:58 GMT+03:00 Marcel Overdijk <[email protected]>:

> Hi Lukas,
>
> I'm not worried about saving the CPU cycles.
> The reason I would like to recycle these objects as I would be able to use
> some generic utility methods like:
>
>
Oh, I see! Then, inverse responsibilities and go functional! How about:


protected <T> Page<T> queryForPage(Supplier<SelectJoinStep> baseQuery,
Pageable pageable,
        RowMapper<T> rowMapper) {


Now you can pass functions to the methods that construct your base query
and in your queryForPage method, you will simply call that function twice.
How does that sound?

Example:

queryForPage( () -> select(TABLE.A, TABLE.B).from(TABLE), pageable, mapper
);



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.

Reply via email to