[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.tools.emf] Re: Complex Map Modeling

Hi,

There are a few considerations that I have to make before answering your question:

- You won't be able to model protected methods or attributes. The basic idea is that everything that you model is, ultimately, accessible to the clients of your code.

- As extensions of the abstract class, Class1 and Class2 inherit the get method so you don't need to defined it again on each class.

- Is there a modeled attribute for the map or are you thinking on using operations? If you are using an attribute, EMF would generate a set(Map<MyClass,?>) method in the abstract class which would conflict with the setters you want to define in the subclasses (a "Java" conflict not an "EMF" one ;-). So I will assume that you are modeling operations.

All that said, I am attaching here a project with an ecore model that has what I think you are trying to do.

Cheers,
Marcelo

Gigaplex wrote:
I have an abstract class that two other classes extend. I need a method in this abstract class like this:

protected abstract EMap<MyClass, ?> getMap();


Then, I have two classes (not abstract) that extend this abstract class that need to look like this:


Class 1
protected EMap<MyClass, ?> getMap();
public void setMap(EMap<MyClass, ADifferentClass>)

Class 2
protected EMap<MyClass, ?> getMap();
public void setMap(EMap<MyClass, SomeOtherClass>)


Is it possible to model something like this in EMF? I've modeled maps before but nothing like this.

Attachment: prj.zip
Description: Zip compressed data