You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Martijn Dashorst <ma...@gmail.com> on 2009/12/01 11:41:38 UTC

Automatic detaching of IDetachables

Not sure if it will fly, but couldn't we utilize the same tech as
project lombok [1] uses to automatically generate detach code for
IDetachables?

Note that I have no idea if it will work, but considering they are
able to generate try/finally blocks, we might be able to do something
similar.

Martijn

[1] http://projectlombok.org

Re: Automatic detaching of IDetachables

Posted by Johan Compagner <jc...@gmail.com>.
So generate a detach() methods that looks up all the fields and do what on
those?
I guess if that is a detachable call it through and annotate other fields
that should be set to null?

so i we have this

class @detachable MyModel
{
     private IModel innerModel;

    private @detach Object myVar;

    private Object id;
}

that is the same as

class MyModel
{
     private IModel innerModel;

    private myVar;

    private Object id;

    void detach()
   {
        innerModel.detach();
        myVar= null;

   }
}

but then somewhere you have to make sure that the id is set


On Tue, Dec 1, 2009 at 11:41, Martijn Dashorst
<ma...@gmail.com>wrote:

> Not sure if it will fly, but couldn't we utilize the same tech as
> project lombok [1] uses to automatically generate detach code for
> IDetachables?
>
> Note that I have no idea if it will work, but considering they are
> able to generate try/finally blocks, we might be able to do something
> similar.
>
> Martijn
>
> [1] http://projectlombok.org
>

Re: Automatic detaching of IDetachables

Posted by Igor Vaynberg <ig...@gmail.com>.
we can easily do this via reflection and an icomponentdetachlistener,
i was going to start looking into it after we sort the urls and push
1.5 out.

-igor

On Tue, Dec 1, 2009 at 2:41 AM, Martijn Dashorst
<ma...@gmail.com> wrote:
> Not sure if it will fly, but couldn't we utilize the same tech as
> project lombok [1] uses to automatically generate detach code for
> IDetachables?
>
> Note that I have no idea if it will work, but considering they are
> able to generate try/finally blocks, we might be able to do something
> similar.
>
> Martijn
>
> [1] http://projectlombok.org
>