Skip to main content



      Home
Home » Modeling » M2T (model-to-text transformation) » [Xpand] Access ClassAttribute before DEFINE Class
[Xpand] Access ClassAttribute before DEFINE Class [message #762252] Wed, 07 December 2011 14:03 Go to next message
Eclipse UserFriend
Hello Guys,

I'm very new to Xpand and I have the following problem.
I got a Class "Template" with an Attribute "type" which is the "Root class" of my model.
I want to do something like:

<<Import model>>

<< IF <<type>>!="String">>
<<DEFINE main FOR Template>>
...
<<ELSE>>
...
<<ENDIF>>

Is it possible to do this this way or through another Xpand-mechanism?
From an OO point of view it could seem stupid to try to access the attribute of an object before the object exists, but as I said I'm new to the language.

Mainly I do ask this question, because I perceived, if I write the shown part into my x.xpt I wouldn't get any fault symbols for syntax errors in current Eclipse Modelling distribution even if I implement faults like <<EDEF>> instead of <<ENDDEFINE>> in later parts of the x.xpt.

Thanks in advance
Re: [Xpand] Access ClassAttribute before DEFINE Class [message #762261 is a reply to message #762252] Wed, 07 December 2011 14:20 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

there editor is sometimes buggy indeed. please make sure you configure thecorrect metamodel kind in your projects xtand/xpand properties section.
and yes what you want to do is totally nonsense
it should look like

«IMPORT model»
«DEFINE main FOR Template»
«FILE "test.txt"»
«IF type=="String"»
//hey this is a string
«ENDIF»
«ENDFILE»
«ENDDEFINE»


~Christian
Re: [Xpand] Access ClassAttribute before DEFINE Class [message #762288 is a reply to message #762261] Wed, 07 December 2011 15:07 Go to previous message
Eclipse UserFriend
Good Evening Christian,

thank you for your fast reply and the affirmation that my idea was stupid Smile.

Cheers
Previous Topic:[Acceleo] how to get the ID of an EObject
Next Topic:[Xpand] Questions regarding implementing MetaModelContributor
Goto Forum:
  


Current Time: Sat Jun 14 05:06:48 EDT 2025

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

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

Back to the top