---- Martin Marinschek <[EMAIL PROTECTED]> schrieb:
> Leonardo,
> 
> can you investigate into the suggestion by Mario - I think this will
> be even better (and easier to achieve) then generating the components
> into the source-tree, as the old MyFaces component generator did.

I'm not quite sure what is being proposed here. Is it that a *base* class be 
generated, and that subclasses be written by hand?

If so, I'm not sure that will work. The code checked in will not compile 
without the base class, so it still has to go into a template directory, which 
is one of the ugliest bits.

IMO, the best solution is where the code checked in to svn *compiles*. IDE 
auto-completion, refactoring, all the other tools that work only with *real* 
code will then be usable again.

> 
> @Everyone: we had a generator once, you remember? It is not in use
> anymore cause nobody maintained it anymore... let's settle for one
> generator, please.

But let's not settle for a bad one, or one that is so difficult to use it keeps 
new developers (or even old ones) away.

> >
> > @why Trinidad doesn't work with annotations: how would you then
> > generate restoreState and saveState? And the getters? You don't want
> > to write all the getters by hand, do you?

I'd be happy to see normal getter/setter methods in 
component/validator/converter classes. Yes, it is a little more code but it is 
*normal* code, that every java programmer can understand at a glance.

The save and restore state stuff is a bit trickier. Yes, it would be nice to 
avoid writing that by hand as it is error-prone. Personally I would be 
*satisfied* (although not happy) to see the system just *verify* hand-written 
code, if that meant that the stuff checked in to svn is real normal compilable 
code. However I think that some better solution can be made, eg by writing

protected Object[] saveState() {
  return StateHelper.saveState(this.getClass());
}

and having StateHelper use reflection to save the state. By doing sensible 
caching I think the performance hit would be insignificant when compared to the 
stuff done by invoking EL expressions etc during the rest of the request 
processing. Of course I haven't tried this yet; just speculating...

Regards,
Simon

Reply via email to