Hey Lukas,

On Mon, May 26, 2014 at 1:25 PM, Lukas Eder <[email protected]> wrote:
> My intuition tells me that this would quickly evolve into something like
> setIfNotNull(...), setIfNotEmpty(...), setIfNotBlank(...), setIfNull(...),
> setIfGtZero(...)
> And what about the equivalent counterpart in the values() clause?
> valuesIfNotNull(...)
> What about fluent predicate building? Condition.andIfNotNull(something,
> Condition)
>
> :-)

I'm sure there's a monad that can handle all of that in one line, but
I'm not sure what color it should be :-)

> Maybe, there is room for a more general setIf(Predicate, ...) API, but I
> still feel that these kinds of additions will be a huge overkill, if we want
> to cover all use-cases for the entire DSL.

Sure, I get that - and to put it in perspective, this functionality is
only ever a nice to have - all it does is save a bit of verbosity.

> Note that you can always just keep a reference to the InsertSetMoreStep, and
> write a couple of if-else statements.

That's exactly what my current code does, and that was the reason why
I started this thread. In practice, the couple of if statements turns
into quite a few, and then multiply that by the number of tables you
are writing to.

Using the Record based API (as indicated earlier in this thread) does
work and scores well for its relative terseness. So it does give me
the ability to compromise - I can go for the type safe variant with a
bunch of if statements or I can for the terse ORM variant.

Man, it's so difficult to a type safe hipster these days ;-)

Cheers,

Ben

-- 
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