Generate custom annotations

14 views
Skip to first unread message

luis.anselm...@gmail.com

unread,
Sep 15, 2016, 3:15:22 PM9/15/16
to jOOQ User Group
Hi! First of all thanks for all the good work and effort in building jooq! We love it!

I just can't seem to find a way to define extra annotations when using a custom generator.
We are generating POJOs with validations, but we wanted to add our custom validation with a simple annotation.

For instance we force columns with .*URL.* expression to be a java.net.URL, but we wanted to add the annotation @URL to validate the input when using the entity in a POST request.

Thanks for the help and keep up the good work.

Lukas Eder

unread,
Sep 15, 2016, 3:28:02 PM9/15/16
to jooq...@googlegroups.com
Hi Luis,

The easiest way to do this is to override the JavaGenerator's printColumnJPAAnnotation method, because that's the one that will be called at the right moment when generating POJOs.

It's a bit of a workaround, but we currently don't support adding arbitrary annotations to arbitrary places in generated classes. There could be quite a few requirements that we don't see yet.

Hope this helps,
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 jooq-user+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages