db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Fischer <fisc...@seitenbau.net>
Subject Re: [Proposal] A general-purpose code generation framework for torque 4
Date Wed, 11 Nov 2009 19:42:24 GMT

Following the question of whether or not add @SuppressWarnings in the
generated source code, I have used this as a showcase for the proposed
generator, showinh how to change the generated output without touching the
original torque templates.
The main idea is that one template-set (in this case a minimal one with
only the changed definitions) can inherit from another template-set (the
"normal" templates). Then the new templates can be plugged in at the
"mergepoints" where the original templates are plugged into each other.
This only works because the templates are relatively small each, so they
are meaningful units to be replaced or, in this case, redefined.

I needed to make some minor changes in the torque-gf package, because I did
not think before of the particular type of re-plugging (i.e. redefinition
of a single mergepoint). The new version is at the same place as the old
one, http://people.apache.org/~tfischer. I did not need update the
templates.
I also updated the test-project, which now generates all the base peers
with the @SuppressWarnings annotations.

In detail, what I did in the test project is:
- I added a minimum torque-gf configuration in /src/main/torque-gf. This
contains the changed mergepoint definition, and the new template producing
the @SuppressWarnings output
- I changed the pom to use the /src/main/torque-gf directory as overriding
directory for the om templates:
          <execution>
            <id>generate-sources</id>
            ...
            <configuration>
              ...
              <overrideConfigDir>src/main/torque-gf</overrideConfigDir>
              ...
            </configuration>
          </execution>
 The "overrideConfigDir" is the "child" package, which inherits all
configuration and definitions form the "parent" in the torque-templates,
and only overrides the changed definitions.

That's all that is needed for the non-invasive adding of the
@SuppressWarnings output.

     Thomas


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message