|
Re: [OCLinEcore] Definition of TemplateSignatureCS? [message #1249781 is a reply to message #1249687] |
Tue, 18 February 2014 16:16 |
Ed Willink Messages: 7670 Registered: July 2009 |
Senior Member |
|
|
Hi
*CS classes are part of the non-normative OCL metamodel, so you should
not use them (unless you are creating an extended OCL language and are
extending the OCL tooling).
You should only use Pivot.ecore (or OCL.ecore if you prefer the Classic
Eclipse OCL).
You can find examples of templates in Pivot.oclas and OCL-2.5.oclas.
I'm pretty certain that the support for template parameter upper/lower
bounds in incomplete.
Regards
Ed Willink
On 18/02/2014 14:16, Martin Hanysz wrote:
> Hello OCL Community,
>
> I am currently in the process of building a metamodel with the
> OCLinEcore Language that makes use of generic type parameters. While
> browsing the Help Pages for Eclipse Kepler I noticed that there is no
> definition of TemplateSignatureCS although it is used to define
> DataTypeCS, EnumerationCS, ClassCS and OperationCS.
>
> So my question is:
> How do I define a class with a type parameter?
>
> Let's say I have a class MyClass that has a type parameter T that
> extends MyOtherClass. How can I define that with the OCLinEcore
> Language? Additionally, how can I use the type parameter T to express
> that MyClass has a reference named myReference to other instances of
> MyClass that have the same type parameter?
>
> What I got so far is:
>
> import ecore : 'http://www.eclipse.org/emf/2002/Ecore#/';
>
> package myPackage : mp = 'http://www.example.com/myPackage.ecore'
> {
> class MyClass(T extends MyOtherClass)
> {
> property myReference : MyClass(T)[*];
> }
> class MyOtherClass;
> }
>
> The OCLinEcore editor accepts this as valid syntax, but when I reopen
> the file, it suddenly contains the following:
>
> import ecore : 'http://www.eclipse.org/emf/2002/Ecore#/';
>
> package myPackage : mp = 'http://www.example.com/myPackage.ecore'
> {
> class MyClass(T)
> {
> property myReference : MyClass[*];
> }
> class MyOtherClass;
> }
>
> As you can see the bound for the type parameter is gone as well as the
> type parameter of the referenced type.
>
> Best regards,
> Martin
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03433 seconds