Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » subclass override field
subclass override field [message #420994] Mon, 21 July 2008 06:35 Go to next message
yeliu is currently offline yeliuFriend
Messages: 145
Registered: July 2009
Senior Member
Hello,
I have 2 questions:
1. there is an abstract class which contains an attribute String
source.In its subclass ,I want to have an EList<String> sourceList instead
of a string and I also don't want the attribute source shown in the
generated editor.How do I implement this in annotated Java code?
2.the abstract class Obj mentioned above have bidirectional relations
with another class Chan.Let's call the relations [Obj]
inputs<----->outgoing[Chan].I want the multipilicity of the relations
varies according to different subclasses of Obj.E.g subclass Net may have
only one outgoing,subclass Gather may have the same number of outgoing as
Rate(int) which is an attribute of Gather.How should I set these
constrictions?

Many thanks!


Ye Liu
Re: subclass override field [message #420995 is a reply to message #420994] Mon, 21 July 2008 07:14 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Hi Ye Liu,

Comments below...



Ye Liu schrieb:
> Hello,
> I have 2 questions:
> 1. there is an abstract class which contains an attribute String
> source.In its subclass ,I want to have an EList<String> sourceList
> instead of a string and I also don't want the attribute source shown
> in the generated editor.How do I implement this in annotated Java code?
You can't have a feature in a derived class *instead* of a feature in a
super class. That said, you can hide properties in the Properties view
by overriding the getPropertyDescriptors() method in the generated
DerivedClassItemProvider class.


> 2.the abstract class Obj mentioned above have bidirectional relations
> with another class Chan.Let's call the relations [Obj]
> inputs<----->outgoing[Chan].I want the multipilicity of the relations
> varies according to different subclasses of Obj.E.g subclass Net may
> have only one outgoing,subclass Gather may have the same number of
> outgoing as Rate(int) which is an attribute of Gather.How should I set
> these constrictions?
I don't think that you can express such constraints in Ecore. Maybe
these links are helpful:
http://help.eclipse.org/stable/index.jsp?topic=/org.eclipse. emf.doc/references/overview/EMF.Validation.html
http://www.eclipse.org/articles/article.php?file=Article-EMF -Codegen-with-OCL/index.html

Cheers
/Eike


>
> Many thanks!
>
>
> Ye Liu
>


Previous Topic:[EMF + Teneo] EMF.edit actions and GMF
Next Topic:Re: teneo: client/server scenario
Goto Forum:
  


Current Time: Thu Apr 18 08:09:32 GMT 2024

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

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

Back to the top