2015-12-29 16:42 GMT+01:00 <[email protected]>:
> Interesting. I hadn't thought about HTML templating libraries. In the Java
>> ecosystem, velocity used to be a popular templating language. But as most
>> templating languages are external DSLs, they are equally flawed compared to
>> Xtend in that they can't really interact well with Java APIs (e.g. with
>> jOOQ-meta)
>>
> I would probably pick something bare bones like mustache for the HTML
> templating language. I think there are a few pros and cons. It could make
> code gen language agnostic, most people already know HTML / HTML
> templating, code customization could be trivial if set up correctly. The
> major cons would be no expressions and no type safety which I agree would
> be very nice. This was just a thought I had when working with the code
> generators.
>
> I think it will be hard to beat Xtend in this area, although I'm very open
>> to suggestions...
>>
> Xtend looks like it could work well. Scala's multi line strings /
> interpolation also isn't bad for adding expressions mid template.
>
Interesting thoughts, thanks. Indeed, the advantage of something extremely
simple like mustache or any other HTML templating language is the ease of
customization. That's actually the advantage of an external templating
language DSL, as opposed to internal "DSLs" like the current approach, or
Xtend/Scala
I think that it might be worth thinking about this more deeply in the
context of the possible modularisation via plugins of the code generator.
If code generation responsibilities can be delegated to individual plugins,
the plugin could use any technology that can be invoked from a Java (i.e.
JVM) process, given some input parameters (schema metadata and code
generator configuration).
Between Xtend and Scala, I would definitely prefer Xtend for this case, as
it is the only language that got indentation right in multiline strings.
I.e. it is easy to format both the template AND the output in a single go.
It's a bit hard to explain in words, you'll have to try. The idea is that
Xtend automatically detects if whitespace is meant to be used to format the
template or the output. Scala uses a trick via library support, but I'm not
convinced.
I believe I posted some of it a long time ago I'll try to get an example
> later. Basically I added a way to easily add multiple where conditions
> using a builder.
>
> new UserDao(ctx).where().firstName("first").lastName("last").age(27)
>
> I believe at the time you suggested exposing a way to just pass in a
> Condition quickly without some of the boilerplate.
>
> t is the user table object
> new UserDao(ctx).where(t ->
> t.FIRST_NAME.eq("first").and(t.LAST_NAME.eq("last")).and(t.AGE.between(min,
> max)))
>
> Something along those lines. It was just a quick way to skip a few lines
> of boilerplate .selectFrom's and mapping the objects back to pojos.
>
I see, interesting. I think I remember now.
I agree that simple filtering is a very common use-case with DAOs (or
repositories, or services, or whatever they're called). It's certainly
worth thinking about this more deeply.
--
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.