|
|
|
Re: Can I generate a block of java independent of my model? [message #1052864 is a reply to message #1052859] |
Tue, 30 April 2013 19:11 |
Dan Barr Messages: 10 Registered: April 2013 |
Junior Member |
|
|
Hey,
Thanks for the link, I'm not using Xbase, just xTend and xText.
I curentlly have this in my .Xtend file
class GameGenerator implements IGenerator {
override void doGenerate(Resource resource, IFileSystemAccess fsa) {
fsa.generateFile(resource.className+".java", toJavaCode(resource.contents.head as Game))
}
def className(Resource res) {
var name = res.URI.lastSegment
return name.substring(0, name.indexOf('.'))
}
def toJavaCode(Game sm) '''
//JAVA CODE HERE
'''
}
Obviously it's not very sophisticated but it gets the job done.
In my java code there is a variable for time curentlly set to 5000 miliseconds,
So now I just need to change that depending on what the user types into the DSL and i'm set.
[Updated on: Tue, 30 April 2013 19:12] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.04746 seconds