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

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.