[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.tools.emf] Re: indexed aggregations/associations

Hi Lorenzo,

An alternative to what Christian suggested would be for you to do it yourself. You could, for example, override the did* (didAdd, didRemove, didMove, ...) methods of the list returned by the getter to populate your own map. This method could be exposed in the interface via an operation or "directly" (adding the method manually).

That said, I believe the best solution would be for us to exploit the EKeys information to generate such accessors for you (you would need to set them in your model). If you are now curious ;-), check out these posts:

"EReference.eKeys" from 6/19/2007 10:09 AM
"about EReference.eKeys" from 6/4/2007 10:43 AM
"EReference.eKeys and code generation" from 6/15/2007 11:39 AM

The last one is not as "basic" as the first two, but actually mentions the accessors you would like to have.

Cheers,
Marcelo.

Christian W. Damus wrote:
Hi, Lorenzo,

Do you mean, something like UML association-end qualifiers?  Ecore doesn't
support that directly.

However, you can define a containment reference of some EObject type
extending EMap.Entry<K, V>.  In this case, if the value is an EReference, I
think you should end up with an EMap<K, V> property that does what you
need, albeit with the overhead of an EObject for each entry.

HTH,

Christian


Lorenzo Bettini wrote:

Hi

I'd like some of my association releations to be indexed, e.g., with a
map, so that they could be easily and efficiently searchable... however
they're implemented with EList...  is there a solution for this?

I also noticed the HKey property, but this does not generate Java code,
only a @model in the generated javadoc...

thanks in advance
Lorenzo