Skip to main content



      Home
Home » Modeling » TMF (Xtext) » M2M Transformation
M2M Transformation [message #1044130] Thu, 18 April 2013 10:27 Go to next message
Eclipse UserFriend
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 15:40 Go to previous messageGo to next message
Eclipse UserFriend
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 16:16 Go to previous message
Eclipse UserFriend
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: Wed Jul 16 21:03:34 EDT 2025

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

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

Back to the top