Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Generated collection access
Generated collection access [message #652190] Wed, 02 February 2011 23:05 Go to next message
Dan Pollitt is currently offline Dan PollittFriend
Messages: 55
Registered: August 2010
Member
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] Thu, 03 February 2011 00:40 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 30544
Registered: July 2009
Senior Member
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: Tue Oct 15 11:00:46 GMT 2019

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

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

Back to the top