Skip to main content



      Home
Home » Modeling » TMF (Xtext) » User-defined reusable type of properties and enumerations in "library" models
User-defined reusable type of properties and enumerations in "library" models [message #1281771] Tue, 01 April 2014 06:27 Go to next message
Eclipse UserFriend
Hi,

I'm wondering if it is possible to define reusable types of properties that could be "instantiated" into model elements. A concrete example, in a first model, I would define a property type with something like:

declare property(Speed,integer)

and use it another model with
use property(Speed,120)

So, I would have some kind of dynamic binding from the type of the property as defined in a "declare" statement and its "usage" with the value specified in its instance.

For the definition rule, it's pretty simple, but I'm puzzled on how to define the other one; especially to avoid defining all values as strings.

A somewhat related question would be if there is a way to define enumerations in a similar way, with something like

type myenumeration values { value1, value2, value3 }

and also being able to instantiate it the same way as I did upper for simple types.

Any help, hint or pointers would be much appreciated.
Cheers,

Fabian
Re: User-defined reusable type of properties and enumerations in "library" models [message #1281779 is a reply to message #1281771] Tue, 01 April 2014 06:44 Go to previous messageGo to next message
Eclipse UserFriend
HI,

what about defining expressions for the values.
and having a stringliteral, intliteral, booleanliteral etc
+ a type system/check for consitencies?
Re: User-defined reusable type of properties and enumerations in "library" models [message #1281786 is a reply to message #1281779] Tue, 01 April 2014 06:55 Go to previous message
Eclipse UserFriend
I effectively thought about it (had a look at Markus Voelter TS), but it now looks more clear as you tell me to do it like this.
Thanks Christian, as usual, you were as fast as accurate!
Previous Topic:Rule is treated as Uncalled rule even if called
Next Topic:Null references in Xtext when we do a clean build
Goto Forum:
  


Current Time: Wed Jul 23 20:56:59 EDT 2025

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

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

Back to the top