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

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.


On Tuesday, December 29, 2015 at 10:19:05 AM UTC-5, Lukas Eder wrote:
>
> Thanks a lot for your feedback, Bill.
>
> I will comment on a few items already now:
>
> Templating language
>>>
>> After working with both Slick code generation and JOOQ code generation I 
>> have been curious why no one has tried to use an HTML templating library. 
>> It is code that generates code dynamically and already has tons of useful 
>> built in features such as includes / partials / conditionals / loops. I 
>> would be interested to try and take a JSON representation of the database 
>> and run it through HTML templates and see how natural it feels. I think an 
>> added benefit would be the ability to add hooks into the code generation 
>> wherever you wanted by just modifying / customizing a few html templates.
>>
>
> 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)
>
> Xtend on the other hand is a compiled language with built-in templating 
> capabilities and excellent IDE support:
>
> https://eclipse.org/xtend/documentation/203_xtend_expressions.html#templates
>
> I think it will be hard to beat Xtend in this area, although I'm very open 
> to suggestions...
>
> Custom code
>>>
>> I have had a pretty good experience customizing the JOOQ DAO generators 
>> on my own. I was able to auto generate some additional queries that I would 
>> use frequently. Getting the code in the right places was sometimes 
>> difficult. I felt somewhat limited by the hooks to add custom code. At the 
>> same time I don't think adding additional hooks is the right solution. You 
>> could end up with tons of before / after hooks for every section of code 
>> and that could get out of hand quickly.
>>
>
> Interesting! Would you mind sharing an example of such a method / query? 
> I'm curious to see if a common use-case might be hidden, here.
>

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