would be nice
johan
On 10/27/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
we have a couple of great candidate callbacks to be implemented with
annotations instead of template methods. namely onattach/detach,
onbegin/endrender
what makes them great candidates is this
1) when implementing one you must always call super()
this is not _always_ true. when extending a core component you dont need
to
because we have our own internalattach() we can use and onattach() is just
an empty template.
but when extending a non-core component you must call super() because you
never know if that component uses it or not and it is very very unlikely
that it is a behavior you want to override
2) implementors of onattach(), if they are good, will make it final and
provide another breakout template to ensure their onattach code cannot be
messed with. this leads you to have
public final void onAttach(){ dosomething(); onAttach2(); } public void
onAttach2() {}
this is the general java pattern that i find very ugly personally, take a
look at our Component.internalAttach() impl :)
so what i propose is that we provide some annotations
@OnAttach @OnDetach @OnBeforeRender @OnAfterRender
users can annotate any number of methods with these and have them called.
im sure there are other places that can benefit from this, but for now we
can cleanup the mess that is internalAttach(), internalOnAttach()
onAttach(), etc
of course this is wicket 2.0 only
-Igor