IMO I prefer to use as much as I can the code autogenerated without
having to add new code to the methods (delegating all this to the code
generator). This eases the process of migrating code. Adding very
specific code to methods might break future migrations (e.g. migrating
tomahawk components to use trinidad state management), as the specific
code could no longer compile. Of course, this can be a minor thing so
I am open to this possibility of "injecting" code before/after the
method's logic, as aspects do. How would you do it, though?
And of course, there is a great space for improving in the plugin and
it would be wonderful at some point to have it based in velocity,

Cheers,

Bruno

On 07/03/07, Mathias Brökelmann <[EMAIL PROTECTED]> wrote:
Hi all,

During myfaces 1.2 development I came across the maven-faces-plugin from
trinidad. AFAIK it uses some xml files which contains the model for
the generated components. This saves a lot of time to quickly get new
components into work. But there is room to improve it.

Currently customizing the generated component classes requires to
write a template file (like UIViewRootTemplate.java) which contains
custom code. I don't like this approach. Since there is no chance to
modify generated methods and to add custom code. That is even worse if
you only want to add something to save/restore state methods or to add
some parameter checking for setters. I've already seen that some dirty
hacks are implemented to make things work - at least for using it in myfaces.

IMO there is a way to solve some of the problems by still having
generated code. I'm thinking of an "in place editing" the generated
code inside special marks like this:

public void setXXX(String xxx)
{
   /* start custom code */
   // do something before the generated code
   /* end custom code */

   _XXX = xxx;

   /* start custom code */
   // do something after the generated code
   /* end custom code */
}

WDYT?

--
Mathias

Reply via email to