Skip to main content



      Home
Home » Modeling » EMF » Generated collection access
Generated collection access [message #652190] Wed, 02 February 2011 18:05 Go to next message
Eclipse UserFriend
Hi,

Just wondering why, when a multiplicity-many reference is declared on an
entity, that to add an entry to the collection on the generated source
model class you have to call <sourceclass>.get<collection>.add(element); as
opposed to <sourceclass>.addTo<collection>(element); ?

Is there something that outweighs the possible downside of having direct
references to the mutable "internals" of the containing class?

Thanks,
Dan
Re: Generated collection access [message #652197 is a reply to message #652190] Wed, 02 February 2011 19:40 Go to previous message
Eclipse UserFriend
Dan,

Comments below.

Dan Pollitt wrote:
> Hi,
>
> Just wondering why, when a multiplicity-many reference is declared on an
> entity, that to add an entry to the collection on the generated source
> model class you have to call <sourceclass>.get<collection>.add(element); as
> opposed to <sourceclass>.addTo<collection>(element); ?
>
No doubt you'd need a remove method too. Also, you might need to add it
to a specific position in the list (e.g., suppose you were modeling the
parameters of a method), so you'd need another overloaded add method
with an index. As you discovered more and more things you kind of need,
you'd end up with the flattened out list API with clear(), removeAll,
addAll(), and so on.
> Is there something that outweighs the possible downside of having direct
> references to the mutable "internals" of the containing class?
>
You don't have access to internals, you're only using the public list
API with no knowledge of implementation internals.
> Thanks,
> Dan
>
Previous Topic:Support for establishing a containment reference to an object
Next Topic:[EMF Query2]first steps with EMF query2
Goto Forum:
  


Current Time: Wed Jul 23 06:25:25 EDT 2025

Powered by FUDForum. Page generated in 0.04989 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top