|
Re: Generated collection access [message #652197 is a reply to message #652190] |
Thu, 03 February 2011 00:40 |
Ed Merks Messages: 33137 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
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.04189 seconds