The jOOQ User Manual. Multiple Pages : Code generation : Advanced generator configuration : Database : RegexFlags | previous : next |
A lot of configuration elements rely on regular expressions. The most prominent examples are the useful includes and excludes elements. All of these regular expressions use the Java java.util.regex.Pattern API, with all of its features. The Pattern
API allows for specifying flags and for your configuration convenience, the applied flags are, by default:
-
COMMENTS
: This allows for embedding comments (and, as a side-effect: meaningless whitespace) in regular expressions, which makes them much more readable. -
CASE_INSENSITIVE
: Most schemas are case insensitive, so case-sensitive regular expressions are a bit of a pain, especially in multi-vendor setups, where databases like PostgreSQL (mostly lower case) and Oracle (mostly UPPER CASE) need to be supported simultaneously.
But of course, this default setting may get in your way, for instance if you rely on case sensitive identifiers and whitespace in identifiers a lot, it might be better for you to turn off the above defaults:
XML configuration (standalone and Maven)
<configuration xmlns="http://www.jooq.org/xsd/jooq-codegen-3.9.2.xsd"> <generator> <database> <regexFlags>COMMENTS DOTALL</regexFlags> </database> </generator> </configuration>
Programmatic configuration
configuration .withGenerator(new Generator( .withDatabase(new Database() .withRegexFlags("COMMENTS DOTALL"))));
Gradle configuration
myConfigurationName(sourceSets.main) { generator { database { regexFlags = 'COMMENTS DOTALL' } } }
All the flags available from java.util.regex.Pattern are available as a whitespace-separated list.