Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » M2M Transformation
M2M Transformation [message #1044130] Thu, 18 April 2013 14:27 Go to next message
Arne Schröder is currently offline Arne SchröderFriend
Messages: 2
Registered: April 2013
Junior Member
Is it possible to transform an XText model beyond simple change of names? I would like to create new types and insert them in the model. Say, my model definition is as follow:
Model:
	types+=Type*;
	
Type: 
	DataType | Bean;

DataType:
	"DataType" name=ID;
	
Bean:
	name=ID "{"
	(attributes+=Attribute)*
	"}";
	
Attribute:
	 name=ID ":" type=[Type];


From every Bean I would like to derive another object, say PersistantBean with new attributes and such. If I can insert these PersistantBeans into the Model, I can generate Java classes from the Beans and different classes from PersistantBeans. Is it possible?
Re: M2M Transformation [message #1044334 is a reply to message #1044130] Thu, 18 April 2013 19:40 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 6544
Registered: July 2009
Senior Member
Hi,

i do not really get your question.
why do you need to physically create additional stuff if this additional stuff is only relevant for generation?

and no there is no default hook for such a m2m
Re: M2M Transformation [message #1044352 is a reply to message #1044334] Thu, 18 April 2013 20:16 Go to previous message
Arne Schröder is currently offline Arne SchröderFriend
Messages: 2
Registered: April 2013
Junior Member
Quote:
why do you need to physically create additional stuff if this additional stuff is only relevant for generation?


Additional objects in the model will simplify the generation. I could use the same generator templates without worrying whether a Bean does mean a simple Bean or PersistantBean in a particular context.

Well, I will try a lighter solution: create lists of modified Beans in a helper method and forward them to the generator template without inserting them into the model.
Previous Topic:Why ScopeProvider is missing when Xbase is used?
Next Topic:Running own DSL-Project in Maven Build
Goto Forum:
  


Current Time: Thu Dec 18 22:40:37 GMT 2014

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

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