On Wed, Jun 4, 2008 at 10:23 AM, Eelco Hillenius
<[EMAIL PROTECTED]> wrote:
> On Wed, Jun 4, 2008 at 10:10 AM, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
>> 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
>
> Maybe. I was trying to avoid having to introspect on every single detachment.

well, like i said, just cache it in a global map.
ConcurrentHashMap<Class<Component>,Collection<Field>>. we do this all
over the place, eg propertyresolver. that way you can even only cache
IModel fields, so the loop becomes even tighter.

-igor

>
> 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]

Reply via email to