[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.mdt] Re: Derive constraints

Javi,

Yes, the current way to do it (as supported by the UML2 code generator) is 
to introduce an operation that has the same signature as the accessor you 
are looking to derive. Ed's also looking at how to provide built-in support 
for feature derivation in EMF - take a look at
https://bugs.eclipse.org/bugs/show_bug.cgi?id=216701.


Kenn

"Javi" <jfbriones@xxxxxxxxx> wrote in message 
news:2ac33d93a79c06410006f82f51a620c5$1@xxxxxxxxxxxxxxxxxx
> Hello Kenn,
>
> Currently I'am successfully using OCL to create body expressions. I saw in 
> the references you gave me how invariant constraints could be specified as 
> well.
>
> But what I would like to have is to specify the body of derived 
> properties.
>
> For example, in the example of Car-Person, imagine I would like to have a 
> property in Car:
>
> Car::/ownerAge (result = self.owner.age)
>
> Thus, I would not need to insert code in Car.getOwnerAge(). In UML I do 
> not have the method getOwnerAge() only the derived property ownerAge.
>
> I just tried to create in UML the method getOwnerAge() besides the 
> property ownerAge and it seems to work. Is this the way to do it? Is it 
> required to add the getter in UML?
>
> Thank you.
>