sounds way too complicated to me dude... component.detach() { for (field:fields) { if (imodel.class.isassignablefrom(field.gettype)) { ((imodel)field.get(this)).detach(); } } onDetach(); }
with proper caching of the actual fields lookup this should be pretty performant -igor On Wed, Jun 4, 2008 at 10:03 AM, Eelco Hillenius <[EMAIL PROTECTED]> wrote: > On Wed, Jun 4, 2008 at 9:43 AM, Igor Vaynberg <[EMAIL PROTECTED]> wrote: >> you still have ondetach()...but for convinience we can automatically >> detach any imodel fields, i actually wanted to do this for a while... > > I tried to write this two days ago, but wasn't able to pull it off... > I wrote an instantiation listener that introspected on the fields of > components and replaced IModel members with a proxy. These proxies > would register themselves with the request cycle for cleaning up > whenever the getObject was called, and the request cycle then would go > through the list of registered models and detach them at the end of > the request. The problem I ran into however is that these members can > be final, assigned at a later stage (typically are actually) and such. > > But if there is some way to automatically detach model members, we > could get rid of the model member in component and instead just let > components have models by default where it actually always makes > sense, such as form components. > > Anyway, that's something for 1.5. If it is fixable, I think that would > be the way out of the generics controversy :-) > > Eelco > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]