You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@polygene.apache.org by Paul Merlin <pa...@apache.org> on 2017/04/23 11:18:59 UTC

ManyAssociation.clear() & NamedAssociation.clear()

Gang,

I'd like to add these two methods:

- ManyAssociation.clear()
- NamedAssociation.clear()

When we want to clear a ManyAssociation or a NamedAssociation today we 
have to iterate over it and remove each element.
Having clear() methods would simplify code.

We do that for example when updating an Entity as part of 
uow.toEntity(value)
This would also help the EntityState implementations to do something 
cheaper than removing each element at a time.

WDYT? Any objection?

Cheers

/Paul


Re: ManyAssociation.clear() & NamedAssociation.clear()

Posted by Niclas Hedhman <ni...@hedhman.org>.
I am good with that?

On Sun, Apr 23, 2017 at 7:18 PM, Paul Merlin <pa...@apache.org> wrote:

> Gang,
>
> I'd like to add these two methods:
>
> - ManyAssociation.clear()
> - NamedAssociation.clear()
>
> When we want to clear a ManyAssociation or a NamedAssociation today we
> have to iterate over it and remove each element.
> Having clear() methods would simplify code.
>
> We do that for example when updating an Entity as part of
> uow.toEntity(value)
> This would also help the EntityState implementations to do something
> cheaper than removing each element at a time.
>
> WDYT? Any objection?
>
> Cheers
>
> /Paul
>
>


-- 
Niclas Hedhman, Software Developer
http://polygene.apache.org - New Energy for Java