On 1/4/07, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
On 1/4/07, Martijn Dashorst <[EMAIL PROTECTED]> wrote: > Perhaps a really baaaaaad idea, but novel in its concept... I know the > @onAttach annotations were not something worth implementing. But the > idea of more flexible attach methods is apparently still compelling.actually i had @OnAttach and @OnDetach full implemented and working, but decided to scratch it. the trouble with annotations is that it really destroys api discoverability. Can we implement a chain of commands for the attach/detach logic (or > any other lifecycle)? In the constructor of a component, the component > builder can register the commands... > > public MyComponent extends Component { > public MyComponent() { > addAttachBehavior(new IAttachBehavior() { public void > onAttach() { myOwnAttach(); }}); > } > } you can do this with IBehavior, just add onattach/ondetach to it.
However, I see IBehavior more as a plugin for external visible effects. And it would break api quite a bit :-)
but really the core of the issue is not flexibility or lack there of. this is a discussion about coding style. the decision is between making it mandatory to call super, or making things final and having multiple breakouts like we did.
Or find a way of doing these things in a way that avoids this discussion altogether. If we can remove the onAttach/onDetach methods in Component, wouldn't that be a solution? Just exploring the space here, not taking a position. We could call the feature "Wicket now uses closures for lifecycle methods" Martijn
